mirror of
https://github.com/brentvollebregt/auto-py-to-exe.git
synced 2026-04-26 04:05:49 +03:00
[GH-ISSUE #309] [Bug] cannot import .py module in same folder as main .py #270
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 @jdai on GitHub (Sep 8, 2022).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/309
Originally assigned to: @jdai on GitHub.
Quick Checks For You
Describe the bug
Traceback (most recent call last):
File "pyidm.py", line 11, in
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
File "pyidm\PyIDM.py", line 24, in
from dependency import install_missing_pkgs
ModuleNotFoundError: No module named 'dependency'
[2416] Failed to execute script 'pyidm' due to unhandled exception!
above log shows pyidm\dependency.py is not found.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
whole project pyidm can be found in github, used to be in pysimplegui.
as I choose single folder to generate .exe, all .py in the folder or in the subfolder would be included. the structure of the project:
project folder is PyIDM, main code is pyidm.c, it just runs pyidm\PyIDM.py;
pyidm\PyIDM.pyhas "from dependency import install_missing_pkgs";
pyidm\dependency.py it has function "def install_missing_pkgs():" it reads PyIDM\requirements.txt which contains package like:
PySimpleGUI>=4.18
pyperclip
plyer
certifi
youtube_dl
pycurl
install_missing_pkgs() check and installs above packages.
Screenshots
If applicable, add screenshots to help explain your problem.
Your Environment:
python --version): 3.8.1 or 3.10pip show auto-py-to-exe): download from github on Sept 7 2022pip show pyinstaller): 5.3pip show eel): 0.14.0Additional context
The challenges are:
1.project folder contains main py code and subfolders contains icon and source code folder
2.main py is just one line to run sub-main code in subfolder, and the sub-main py code can run directly
3.sub-main code imports several local and public packages, and access requiremtns.txt in main folder
4.code check and install public packages via pip, including pycurl that need refers to Internet (still using pip cmd)
5.to make pyidm project running, I did change style of "from .<> import" to remove the '.' as it gives error:
from .version import version
ImportError: attempted relative import with no known parent package
In fact I don't know how to import packages in sub folders, with or w/o '.' sometimes work sometimes not
@brentvollebregt commented on GitHub (Sep 8, 2022):
Your script is named "pyidm.py" and the library you are importing is called "pyidm" - are you sure you really ran your script before packaging?
@jdai commented on GitHub (Sep 8, 2022):
of course I run my file and it works w/o error. After use your tool:
1.my source folder becomes empty - terrible and I'm struggle to get them back
2.latest convert exe can run but w/o any result - run, done, nothing.
3" the library you are importing is called "pyidm" not that simple. source codes in base, pyidm and icon folders, code refers to many global packages.
@jdai commented on GitHub (Sep 8, 2022):
I suggest you read all filenames of a project, then match them in all source codes, then you won't miss the usage. any local source code - I mean .py - can refer to sub,parallel level or base folder. Also handle all import statement. If your code is smart, it shall handle common requirements.txt or similar.
@brentvollebregt commented on GitHub (Sep 9, 2022):
What source code??? You have no reproduction steps. Please provide proper reproduction steps otherwise I will need to close this.
@jdai commented on GitHub (Sep 22, 2022):
https://github.com/P3NG3R/pyIDM
please try to convert it to exe thus you can find lots of errors. In another thread I already told you how to install pucurl.
@github-actions[bot] commented on GitHub (Oct 23, 2022):
This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.
@jdai commented on GitHub (Oct 28, 2022):
pls close it, not pysimplegui problem