How to import the package being frozen in the PyInstaller spec file?

I have this directory structure:

mypackage/
|___ installer.spec
|___ package/
    |___ __init__.py

and package.__init__.py contains some variables I'd like to use in my installer.spec file. So this file contains a import package line. However, running pyinstaller installer.spec in mypackage/ fails with a ModuleNotFoundError.

How can I retrieve variables from the package I want to freeze while freezing it with PyInstaller?



Read more here: https://stackoverflow.com/questions/66345912/how-to-import-the-package-being-frozen-in-the-pyinstaller-spec-file

Content Attribution

This content was originally published by Daniel Diniz at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: