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.
Seems like you are facing issues with the resource path when compiling the py program with Nuitka. Have you tried using the --output-dir flag to ensure that the resource paths are correctly referenced? Additionally, make sure to use the appropriate relative paths from the executable location. This way, the program can locate the necessary resources regardless of its location.