18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 21:15:20 +01:00
Files
maszyna/scripting
maj00r 1ebdb4d6fd fix(python): the screens start when an older install left .pth files in site-packages
A player's log showed no Python screen in any cab: importing PIL in abstractscreenrenderer failed with
"cannot import name 'six' from 'pkg_resources.extern'", coming from pillow-4.0.0-py2.7-win-amd64.egg in
python64\Lib\site-packages. Neither that egg nor pkg_resources is in the current Steam build: they are what an
older Python 2.7 install left in the game folder. The site module runs every .pth file in site-packages, and the
easy-install.pth of the old setuptools moves its eggs to the front of sys.path, so the old Pillow was found before
the one the game comes with.

The interpreter now starts without the site module (site_import = 0) and puts the site-packages folders that
sysconfig gives (purelib, platlib) at the end of sys.path itself, where site put them, without running the .pth
files. A clean install has no .pth files, so for it nothing changes. The user site folder of the player's own
Python (%APPDATA%\Python) is no longer read either.

Tried in a test folder with an easy-install.pth and an egg whose PIL raises ImportError planted in python64: the
build of master before this change logs the ImportError from the egg, this one logs "Python Interpreter: setup
complete". Linux and macOS use the same sysconfig paths but weren't run.
2026-12-01 22:07:37 +01:00
..