I have a python project that has a following files tree:
\main_dir
gui.py
data.py
\lib
\files
file1.txt
file2.txt
... more_dirs and files in lib.
The gui.py
imports data.py
. data.py
parses file1.txt
as part of it constructor.
I want to run gui.py
as an executable in windows and therefore use pyinstaller.
data.py
opens file1.txt
whlie using a relative path: file1_dir = os.path.join(os.path.curdir, "lib", "files")
I run the following command:
pyinstaller "..fullpath..\main_dir\gui.py" -p "..fullpath..\main_dir\" --runtime-hook "..fullpath..\main_dir\lib"
The pyistaller succesfully package data.py
but when run the executable file I get the following error:
"FileNotFoundError: the system cannot find the path specified: '.\lib\files\'
I tried to change the hook to be <fullpath>\main_dir\lib\files
but got the same error.
What am I doing wrong? How do I add relative dir & files to the executable?