0

I have made a python program using pygame, and I want to make it a bundled executable. The command I have tried using is this pyinstaller --onefile --windowed --add-data "./resources;." main.py.

The resources directory is the only directory with files I need to access (*.png, *.wav). After running the produced .exe file, I get this error. I don't think it's a problem with the type of audio file, although if it is I can easily change it to OGG or MP3.

PyInstaller tends to be weird and error prone for me, so thank you in advance for any help!

  • 1
    It's looking for `resources` in the current directory, which doesn't exist. – John Gordon Nov 21 '21 at 22:20
  • The option you’re using `--add-data "./resources;."` is saying ‘put files from ./resources into .’. But your code is expecting them in the resources folder. You should probably use option `--add-data "./resources;./resources" – DisappointedByUnaccountableMod Nov 21 '21 at 22:45
  • @balmy That didn't change anything, I still got the same error... – DavyJonesStockings Nov 21 '21 at 23:38
  • Have you adjusted path to find these using sys._MEIPASS, see the PyInstaller documentation. If you’d thoroughly read the link from @john-hen you’d see this answer https://stackoverflow.com/a/44352931/2318649 (note, don’t change cwd, adapt the paths to files in the bundle) – DisappointedByUnaccountableMod Nov 22 '21 at 07:14

0 Answers0