Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: local variable 'ext' referenced before assignment #260

Open
ll7 opened this issue Feb 18, 2022 · 3 comments
Open

UnboundLocalError: local variable 'ext' referenced before assignment #260

ll7 opened this issue Feb 18, 2022 · 3 comments

Comments

@ll7
Copy link

ll7 commented Feb 18, 2022

Issue summary

I am trying to install a rom and I get the following error:

roms$ python -m retro.import .
Traceback (most recent call last):
  File "/home/luttkule/anaconda3/envs/rl-test/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/luttkule/anaconda3/envs/rl-test/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/luttkule/anaconda3/envs/rl-test/lib/python3.9/site-packages/retro/import/__main__.py", line 4, in <module>
    main()
  File "/home/luttkule/anaconda3/envs/rl-test/lib/python3.9/site-packages/retro/scripts/import_path.py", line 21, in main
    known_hashes = retro.data.get_known_hashes()
  File "/home/luttkule/anaconda3/envs/rl-test/lib/python3.9/site-packages/retro/data/__init__.py", line 401, in get_known_hashes
    known_hashes[sha] = (game, ext, os.path.join(path(), curpath))
UnboundLocalError: local variable 'ext' referenced before assignment

This is the content of the directory:

roms$ ls
'Street Fighter II'\'' - Special Champion Edition (Europe).md'  'Street Fighter II'\'' - Special Champion Edition (Europe).zip'

I downlaoded and extracted the rom from https://wowroms.com/en/roms/sega-genesis-megadrive/download-street-fighter-ii-special-champion-edition-europe/26496.html

System information

  • [Operating system] Ubuntu 20.04
  • [Python version] 3.9.10
  • [Gym Retro version] 0.7.1
@pacess
Copy link

pacess commented Feb 21, 2022

A quick fix for your case, edit /home/luttkule/anaconda3/envs/rl-test/lib/python3.9/site-packages/retro/data/init.py line 401, replace ext with ".md". It should be look like:

known_hashes[sha] = (game, ".md", os.path.join(path(), curpath))

@ll7
Copy link
Author

ll7 commented Feb 24, 2022

Thank you.

It seems to me that the import is still not successful:

(rl-test) luttkule@LeLuGPC-u:/mnt/UHDD/git/rl-test/nicholas-renotte/streetfighter/roms$ ls
'Street Fighter II'\'' - Special Champion Edition (Europe).md'  'Street Fighter II'\'' - Special Champion Edition (Europe).zip'
(rl-test) luttkule@LeLuGPC-u:/mnt/UHDD/git/rl-test/nicholas-renotte/streetfighter/roms$ python -m retro.import .
Imported 0 games
(rl-test) luttkule@LeLuGPC-u:/mnt/UHDD/git/rl-test/nicholas-renotte/streetfighter/roms$ python -m retro.import 'Street Fighter II'\'' - Special Champion Edition (Europe).md'
Imported 0 games
(rl-test) luttkule@LeLuGPC-u:/mnt/UHDD/git/rl-test/nicholas-renotte/streetfighter/roms$ python -m retro.import .
Imported 0 games
(rl-test) luttkule@LeLuGPC-u:/mnt/UHDD/git/rl-test/nicholas-renotte/streetfighter/roms$ python -m retro.import Street\ Fighter\ II\'\ -\ Special\ Champion\ Edition\ \(Europe\).md
Imported 0 games

@onaclov2000
Copy link

I'm not 100% sure but did you make sure your rom.sha matches the file you downloaded? If not you might need to update/create a rom.sha file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants