I need to compile a Python program in nuitka so that the output is one exe file with resources packed inside. I tried setting the --include-data-dir flags and all that stuff, but the compiled executable crashes if I move it to another location, saying resource files were not found.
This is what the directory looks like where all the files are located:
client/
fnt/
#here fonts
img/
#here images
util/
#here modules
icon.ico
main.py
In the terminal, being in the client folder, I set the directives:
py -m nuitka --standalone --onefile --include-data-dir=fnt=fnt --include-data-dir=img=img --windows-icon-from-ico=icon.ico main.py
Also I tried this:
py -m nuitka --standalone --onefile --include-data-dir=../client/fnt=fnt --include-data-dir=../client/img=img windows-icon-from-ico=icon.ico main.py
All the same, the program crashes and asks for files nearby.
I need to build a completely self-contained exe that doesn't require external dependencies.
What am I doing wrong?
P.S. Util is only .py files, they are compiled normally. With icon also no problems.
Maybe consider using the --include-data-file option instead of --include-data-dir. This way, the files will be included in the executable directly, allowing the program to access them without relying on external files. Make sure to specify all relevant files using this option during the compilation process. This should resolve the issue.