0

I made a script with GUI (using the pySimpleGui library) and this GUI has some images and all of them are stored in the folder img (the structure is like .\script\app.py and .\script\img\*.png). When I use pyinstaller without option --onefile then everything is ok and in dist folder, I can find my app.exe with a bunch of other files and folders and I can run it without any problem with all images included.

However, I would like to have a single .exe to distribute so when I add an option --onefile the app.exe no longer works as pysimpleGui complains about missing images. Any idea how I can cramp the entire img folder with all of the files to the .exe file? I'm using --add-data option and this works fine as long as --one-file is not used.

kubn2
  • 135
  • 1
  • 7
  • read PyInstaller documentation - it may need to set it in confing file `.spec` – furas Oct 20 '22 at 19:24
  • did you run .exe in console to see full error message? Maybe it needs to create correct path in code to read file from correct folder. Code may run with different `Current Working Directory` and it may need full path to image(s) – furas Oct 20 '22 at 19:26
  • [python - Bundling data files with PyInstaller (--onefile) - Stack Overflow](https://stackoverflow.com/questions/7674790/bundling-data-files-with-pyinstaller-onefile) – furas Oct 20 '22 at 19:49
  • `psgcompiler` is a front-end for PyInstaller that may be helpful. – Mike from PSG Oct 21 '22 at 12:42

0 Answers0