So I have made this python file which I want to compile (it's called ElPatron) to a .exe file with Nuitka. I did it correctly and this is the dist folder that came with that (using the --standalone argument that Nuitka has)
This is the nuitka command I used:
.\python.exe -m nuitka --mingw64 .\ElPatron.py --standalone --onefile --windows-disable-console --windows-icon-from-ico=pdf.ico --include-data-file=C:\Users\User\AppData\Local\Programs\Python\Python39\example.pdf=example.pdf
I included the pdf in the exe using the --include-data-file argument from Nuitka
The problem I have now is that I don't know where this(the example.pdf) get's stored when the ElPatron.exe is executed. I want to know this so I can call it inside my Python project.
The question
Where does the example.pdf get stored when a windows computer executes the .exe (containing the pdf)?
From looking at the Nuitka documentation, it says:
# Create a binary that unpacks into a temporary folder python -m nuitka --onefile program.py
Note
There are more platform specific options, e.g. related to icons, splash screen, and version information, consider the
--help
output for the details of these and check the section “Good Looks”.Again, on Windows, for the temporary file directory, by default the user one is used, however this is overridable with a path specification given in
--windows-onefile-tempdir-spec=%TEMP%\\onefile_%PID%_%TIME%
which is the default and asserts that the temporary directories created cannot collide.
So, I think the output should show up as a subdirectory in %TEMP%
as described, which should be the path C:\Users\%USERNAME%\AppData\Local\Temp\
.
If you want to use the default path, you'll have to find the dynamically-named subfolder (onefile_%PID%_%TIME%
) within %TEMP%
in Python, and you can get the current process ID, then use a fuzzy pattern or something, as you won't be able to know the exact time. Otherwise, set a custom path.