Kautenja / gym-super-mario-bros

An OpenAI Gym interface to Super Mario Bros. & Super Mario Bros. 2 (Lost Levels) on The NES
Other
678 stars 133 forks source link

AttributeError: module 'pyglet.clock' has no attribute 'set_fps_limit' #96

Closed glad4enkonm closed 4 years ago

glad4enkonm commented 4 years ago

Describe the bug

I'm trying to run gym_super_mario_bros.exe and getting this error:

Traceback (most recent call last): File "Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "Programs\Python\Python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File ".env\Scripts\gym_super_mario_bros.exe__main.py", line 7, in File ".env\lib\site-packages\gym_super_mario_bros_app\cli.py", line 66, in main play_human(env) File ".env\lib\site-packages\nes_py\app\play_human.py", line 24, in play_human clock.set_fps_limit(env.metadata['video.frames_per_second']) File ".env\lib\site-packages\pyglet\init.py", line 334, in getattr__ return getattr(self._module, name) AttributeError: module 'pyglet.clock' has no attribute 'set_fps_limit'

Reproduction Script

import sys
import pkg_resources
import platform
print(platform.platform())
print(sys.version_info)
print(pkg_resources.get_distribution("nes-py").version)
print(pkg_resources.get_distribution("gym-super-mario-bros").version)

import subprocess
with open('output.txt', 'w') as output_f:
    p = subprocess.Popen('.env\\Scripts\\gym_super_mario_bros.exe',
                         stdout=output_f,
                         stderr=output_f)

Expected behavior

I expect to see no error message

Kautenja commented 4 years ago

pretty sure pyglet deprecated the clock functionality for some reason. I don't have time to work out a solution, but feel free to take a stab at it. Someone forked with a fix, but never opened a PR.

ltbd78 commented 4 years ago

There is a temporary fix:

  1. sudo vim <path to your python>/site-packages/nes_py/app/play_human.py
  2. Type /clock.set to find the error line
  3. Comment out that line.
  4. Save and quit with :wq!
ChiscoD commented 4 years ago

There is a temporary fix:

1. `sudo vim <path to your python>/site-packages/nes_py/app/play_human.py`

2. Type `/clock.set` to find the error line

3. Comment out that line.

4. Save and quit with `:wq!`

When I run with this line commented, only a black screen renders

Kautenja commented 4 years ago

resolved