In Windows, running cdpedia.bat (or python\python.exe cdpedia.py) from image root fails:
Traceback (most recent call last):
File "cdpedia.py", line 36, in <module>
import config # NOQA
ModuleNotFoundError: No module named 'config'
Reason
The embeddable python for windows comes with a python*._pth file that overrides sys.path at runtime and by design the current working directoryis not included. As config.py is now in the image root (the cwd), cdpedia.py can't find it.
Description
In Windows, running
cdpedia.bat
(orpython\python.exe cdpedia.py
) from image root fails:Reason
The embeddable python for windows comes with a
python*._pth
file that overridessys.path
at runtime and by design the current working directory is not included. Asconfig.py
is now in the image root (the cwd),cdpedia.py
can't find it.Reference: https://docs.python.org/3/using/windows.html#finding-modules
Solution
Delete any
*._pth
file from embedded python directory to restoresys.path
normal behaviour (having cwd as first item)