Attempted to compile packages by compiled individual python files went wrong
See original GitHub issueI’m having an issue when running main entry points located in sub packages of regular packages. Seems to be related to the compilation of __init__.py
files of sub packages.
My output of python -m nuitka --version
is:
0.8.4
Commercial: None
Python: 3.9.5 (default, Mar 28 2022, 18:48:27)
Flavor: pyenv
Executable: /home/eyepick/.pyenv/versions/3.9.5/bin/python
OS: Linux
Arch: x86_64
Distribution: Ubuntu (based on Debian) 20.04.4
I installed Nuitka using python -m pip install nuitka
, as recommended in the readme.
My output of python -m pip freeze
is empty (the issue can be reproduced with no external dependency).
In order to reproduce the issue, download the zip. It contains:
- a bash script that does a depth-first search in the directory given as argument and compile each python module with Nuitka (skipping the black listed folders and directories given as arguments). It’s use is like:
bash nuitkize.sh package-name -f package-name/dir1/file1.py package-name/dir1/file2.py ... -d package-name/dir3 package-name/dir4 ...
It will compile each file of the package named package-name
while skipping the files package-name/dir1/file1.py
, package-name/dir1/file2.py
, … and the directories package-name/dir3
, package-name/dir4
, …
- A test package to reproduce the issue.
To reproduce the issue, unzip the zip, cd into the folder and run bash nuitkize.sh test-package -d test-package/scripts
. Then, run python -B -m scripts.script1
to get the error:
ImportError: dynamic module does not define module export function (PyInit_dir1)
Repeat the procedure but now compilng it by running bash nuitkize.sh test-package -f test-package/__init__.py test-package/dir1/__init__.py -d test-package/scripts
. When running python -B -m scripts.script1
it should now run normally and print Entry f1
.
Issue Analytics
- State:
- Created a year ago
- Comments:13 (10 by maintainers)
Top GitHub Comments
The new warning is part of the 0.9.2 hotfix release I just made. Nothing to do here really anymore.
Part of factory now, will be in next hotfix release too, https://nuitka.net/doc/factory.html