mirror of
https://github.com/brentvollebregt/auto-py-to-exe.git
synced 2026-04-27 04:35:50 +03:00
[GH-ISSUE #82] Importing from directory named the same as the main py file does not work #80
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @evilmrhenry on GitHub (Dec 14, 2019).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/82
hello_world.py:
hello_world\importer.py:
(Also toss an init.py file in there as well.)
If run directly via python, the result is
import complete
running main
running function
If compiled with auto-py-to-exe first (single file mode), nothing is output, even if the exe is moved to a different directory. Changing the directory name causes everything to work as expected. If debug is turned on, it outputs a bunch of stuff, but no obvious warnings about this. I would prefer this to work, or failing that, have it output a useful warning somewhere.
@brentvollebregt commented on GitHub (Dec 14, 2019):
If you put a print statement in hello_world\__init__.py, after packaging and executing the output you can see that the init file of the hello_world package is what's being run (due to the print being executed). This has occurred due to the filename being packaged and a module in the same directory named the same - thus PyInstaller is taking the package over the specified file.
This unfortunately is not a bug with auto-py-to-exe directly and lies in PyInstaller. I see that if you remove the import statement and
importer.runme()from hello_world.py, PyInstaller will still package the module.@brentvollebregt commented on GitHub (Apr 12, 2020):
Closing due to no response from the issue author.