gutomaia / pyNES

Python programming for Nintendo 8 bits
BSD 3-Clause "New" or "Revised" License
1.22k stars 109 forks source link

Error on compile pynes/examples/helloworld.py #42

Closed p1k0chu closed 1 year ago

p1k0chu commented 3 years ago

I write commands:

$ git clone https://github.com/gutomaia/pyNES
$ cd pyNES/
$ python3 setup.py install
$ pynes py pynes/examples/helloworld.py -o helloworld.nes

Output:

Traceback (most recent call last):
  File "/usr/local/bin/pynes", line 4, in <module>
    __import__('pkg_resources').run_script('pyNES==0.0.2', 'pynes')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1463, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.8/dist-packages/pyNES-0.0.2-py3.8.egg/EGG-INFO/scripts/pynes", line 7, in <module>
    main(sys.argv)
  File "/usr/local/lib/python3.8/dist-packages/pyNES-0.0.2-py3.8.egg/pynes/__init__.py", line 82, in main
    args.func(args)
  File "/usr/local/lib/python3.8/dist-packages/pyNES-0.0.2-py3.8.egg/pynes/__init__.py", line 86, in exec_py
    pynes.composer.compose_file(args.input, output=args.output,
  File "/usr/local/lib/python3.8/dist-packages/pyNES-0.0.2-py3.8.egg/pynes/composer.py", line 327, in compose_file
    game = compose(code)
  File "/usr/local/lib/python3.8/dist-packages/pyNES-0.0.2-py3.8.egg/pynes/composer.py", line 345, in compose
    builder.visit(python_land)
  File "/usr/lib/python3.8/ast.py", line 363, in visit
    return visitor(node)
  File "/usr/lib/python3.8/ast.py", line 439, in generic_visit
    value = self.visit(value)
  File "/usr/lib/python3.8/ast.py", line 363, in visit
    return visitor(node)
  File "/usr/lib/python3.8/ast.py", line 448, in generic_visit
    new_node = self.visit(old_value)
  File "/usr/lib/python3.8/ast.py", line 363, in visit
    return visitor(node)
  File "/usr/local/lib/python3.8/dist-packages/pyNES-0.0.2-py3.8.egg/pynes/composer.py", line 57, in visit_List
    expr = self.generic_visit(node)
  File "/usr/lib/python3.8/ast.py", line 439, in generic_visit
    value = self.visit(value)
  File "/usr/lib/python3.8/ast.py", line 363, in visit
    return visitor(node)
  File "/usr/lib/python3.8/ast.py", line 393, in visit_Constant
    return visitor(node)
  File "/usr/local/lib/python3.8/dist-packages/pyNES-0.0.2-py3.8.egg/pynes/composer.py", line 54, in visit_Num
    return Num(NesInt(node.n))
NameError: name 'Num' is not defined

Can anyone help me?

Python version: 3.8.5

cgbsu commented 3 years ago

I'm having the same problem, my team and I actually may want to contribute to the project for our school project.

If we are going too though we kinda need an answer soon.

Did you try running from the root directory with python bin/pynes py examples/helloworld/helloworld.py? If not, what command did you use?

ehulinsky commented 3 years ago

I had exactly the same error, but I fixed it by using Python 2.7 instead of 3.8. Here are commands I ran:

cd pyNES
sudo python2.7 setup.py install
pynes py pynes/examples/helloworld.py -o helloworld.nes
p1k0chu commented 1 year ago

Commands by ehulinsky actually work so i'm finally closing this issue.

cd pyNES
sudo python2.7 setup.py install
pynes py pynes/examples/helloworld.py -o helloworld.nes

Helloworld.nes actually works if you try in FceUX (NES emulator)