Importing a module from a compiled script

51 views
Skip to first unread message

Yitzhak Weissman

unread,
Feb 22, 2021, 12:45:02 PM2/22/21
to PyInstaller
I am trying to import a module from within a compiled script, and can't get it done. Here is the situation.
I have a folder 'e:\Python import 'which contains a subfolder 'myscript' and a script 'dummy.py'. The subfolder 'myscript' contains another script 'import_lib.py'.dircetories.jpg
The code in 'import_lib.py' is:
import sys
sys.path.append(r'e:/Python import/')
import dummy

I want to compile 'import_lib.py' and run it from a different computer, which does not have 'dummy.py', or even the folders shown above. How this can be done with pyinstaller?


Yitzhak Weissman

unread,
Feb 23, 2021, 3:43:45 AM2/23/21
to PyInstaller
I have read several times the "Using pyinstaller" page before I posted the question. But after an overnight, the answer came to me this morning. The '-p DIR' option does it :). One more small step forward in understanding pyinstaller.
Thank you for looking.

Sebastian Ulanowski

unread,
Jul 9, 2021, 4:41:30 AM7/9/21
to PyInstaller
i have the same issue :-(
You are talking about this?
pyi-makespec --paths=/path/to/thisdir \ --paths=/path/to/otherdir myscript.py

Can you tell me where i have added above? During building exe file?
Could you please provide full command? I will be grateful
Reply all
Reply to author
Forward
0 new messages