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

[3.x] Runtime errors with Python 2.7.18 #264

Open
Nutzzz opened this issue Apr 24, 2022 · 5 comments
Open

[3.x] Runtime errors with Python 2.7.18 #264

Nutzzz opened this issue Apr 24, 2022 · 5 comments

Comments

@Nutzzz
Copy link

Nutzzz commented Apr 24, 2022

Describe the bug
Using FoFiX 3.122 or 3.123 and Python 2.7.18 (x86) in Windows 11, once dependencies have been resolved and FoFiX is successfully building [with py2exe], I get a runtime error in FoFiX.exe.log: "ImportError: No module named difflib." It looks like difflib should be built-in, but I tried pip installing cdifflib, ndifflib, pydiff with the same result. Just for fun I also tried installing diff, which installs a few prerequisites, including attrs, which until it is removed gives me "invalid syntax" in _next_gen.py on the next compile; once that's removed I get the same as above.

Error message

  File "FoFiX.py", line 108, in <module>
  File "GameEngine.pyo", line 32, in <module>
  File "numpy\__init__.pyo", line 187, in <module>
  File "numpy\testing\__init__.pyo", line 10, in <module>
  File "unittest\__init__.pyo", line 59, in <module>
  File "unittest\case.pyo", line 6, in <module>
ImportError: No module named difflib

As a test, I commented out line 73 of setup_exe.py, "difflib", from options={"py2exe":...{"excludes":[]...}
This actually starts the game briefly, but then I get a runtime error in fofix.log:

[    0.000000] (D) Logging initialized: Fri Apr 22 15:22:51 2022
[    1.276000] (W) Pitch bending is not supported; install john.stumpo's pitchbend module (r7 or higher) if you want it.
[    1.792000] (D) GameEngine class init (GameEngine.py)...
[    1.792000] (D) FoFiX v3.123 Final starting up...
[    1.792000] (D) pygame version: 2.0.3
[    1.793000] (D) Initializing audio.
[    1.841000] (D) Audio configuration: (48000, -16, 8)
[    1.899000] (D) Initializing pygame.mixer & audio system at 44100 Hz.
[    1.899000] (D) Initializing video.
[    2.514000] (E) Terminating due to unhandled exception:
Traceback (most recent call last):
  File "FoFiX.py", line 276, in <module>
  File "FoFiX.py", line 175, in main
  File "GameEngine.pyo", line 550, in __init__
  File "Video.pyo", line 102, in setMode
  File "PIL\Image.pyo", line 2818, in open
IOError: cannot identify image file 'data\\fofix_icon.png'

"data\fofix_icon.png" does exist, and is a valid png file. I tried replacing it with different png files: no change. I tried commenting out lines 497-8 from GameEngine.py and 186 from Credits.py, but falling into "icon = None" results in a runtime "AttributeError: 'NoneType' object has no attribute 'read'"

To Reproduce

  1. Fresh install of Python 2.7.18 (x86) on Windows 11 [Note I also tried ActivePython 2.7.18 (x86), but the result was similar, though note the state tool doesn't want to install anything; it seems perhaps because of the CVE in bzip 1.0.6.]
  2. Note requirements.txt does not seem to exist anymore, so these were the prerequisites I figured my way through (beyond the win32 dependency pack):
pip install wheel pywin32 py2exe_py2 pyopengl pyopengl-accelerate pygame numpy pyaudio pillow python-gettext

[EDIT: I found the requirements.txt in the root of the repo that somehow didn't get packaged with the release .zip. Same difflib error, and after commenting out difflib, same image error [other than the callout for the older version of pygame.]

  1. Build and compile:
python setup.py build_ext --inplace --force
python setup.py py2exe

Environment (please complete the following information):

  • OS: Windows 11
  • Python version: 2.7.18 (x86)
@Nutzzz Nutzzz added the bug label Apr 24, 2022
@Nutzzz
Copy link
Author

Nutzzz commented Apr 24, 2022

Note that running "python FoFiX.py" in the src directory seems to work just fine.

@Nutzzz
Copy link
Author

Nutzzz commented Apr 25, 2022

Using the latest master with the versions in requirements.txt, compiling with py2exe gives me an issue with distutils (another built-in):

Traceback (most recent call last):
  File "FoFiX.py", line 50, in <module>
    import PIL.JpegImagePlugin
  File "PIL\JpegImagePlugin.pyo", line 42, in <module>
  File "PIL\TiffImagePlugin.pyo", line 44, in <module>
ImportError: No module named distutils.version

Here, running "python FoFiX.py" gives me the pygame announce but then stops before a log is created.

@Linkid Linkid changed the title Runtime errors with Python 2.7.18 [3.x] Runtime errors with Python 2.7.18 Apr 30, 2022
@Linkid
Copy link
Member

Linkid commented Apr 30, 2022

Hi! Thanks for your report. Is it possible to create a new issue for the 4.x version (the one in master), please?

@Linkid
Copy link
Member

Linkid commented Apr 30, 2022

About difflib, it seems that numpy needs it. Which version of numpy are you using ?

@Nutzzz
Copy link
Author

Nutzzz commented May 5, 2022

Which version of numpy are you using ?

1.16.6

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

No branches or pull requests

2 participants