0
votes

How do I package files into an EXE file that is generated via PyInstaller --onedir?

I see, that I can add the file with

a.zipped_data+=["version.json", "version.json", "DATA]
PYZ(a.pure, a.zipped_data)

pyi-archive_viewer shows the file in PYZ-00.pyz

But

pkg_util.find_loader("testmod").get_data("version.json") 

does not find the file.

NB: I can't use --onefile mode, because it would need to unpack several 100 MB at each program start. And I want to tie several files (not only the version file) with the executable.

1

1 Answers

0
votes

The name passed to get_data was wrong.

For an Windows executable c:\test\testpgm.exe the correct name would be c:\test\version.json

In Linux the executable might be /usr/local/bin/test/testpgm and the correct name would be /usr/local/test/version.json