simons-public / protonfixes

A module for applying fixes at runtime to unsupported games with Steam Proton without changing game installation files
https://simons-public.github.io/protonfixes/
Other
232 stars 117 forks source link

`from protonfixes import debug` fails #160

Closed bmaupin closed 2 years ago

bmaupin commented 3 years ago

As I mentioned in #159, from protonfixes import debug is silently failing.

If I import it manually then I can see the error:

$ cd ~/.config/protonfixes
$ python3

>>> import os
>>> import sys
>>> from importlib import import_module
>>> 
>>> gameid = '63600'
>>> sys.path.append(os.path.expanduser('~/.config/protonfixes'))
>>> game_module = import_module('localfixes.' + gameid)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/user/.config/protonfixes/localfixes/63600.py", line 5, in <module>
    from protonfixes import debug
  File "/usr/local/lib/python3.8/dist-packages/protonfixes/debug.py", line 8, in <module>
    from __main__ import CURRENT_PREFIX_VERSION, basedir
ImportError: cannot import name 'CURRENT_PREFIX_VERSION' from '__main__' (unknown location)

If I comment out that one line, the other imports seem to work fine, e.g.

from protonfixes import util
from protonfixes.logger import log

So I think protonfixes is installed correctly (I installed it using sudo pip3 install protonfixes).

Thanks!

bmaupin commented 3 years ago

I just realized that I added from protonfixes import debug in the wrong file ... I only happened to see in https://github.com/simons-public/protonfixes/wiki/Proton-user_settings.py-examples that I'm supposed to add it to user_settings.py whereas I'd added it to my game fix.

Do you think https://github.com/simons-public/protonfixes/wiki/Writing-Gamefixes could be updated to specifically mention the file where from protonfixes import debug supposed to be added? I guess there's no way to submit a PR for a wiki or I'd submit one myself.

Thanks!