Kautenja/gym-super-mario-bros

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

glad4enkonm opened this issue · 4 comments

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

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.

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!

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

resolved