Grr
Grr

Reputation: 16079

pyinstaller onefile not including data files

I have an application I would like to package into a single file, but am running into issues with the --onefile option including html, js, and css files. The process works fine when running --onedir (of course after adding the path and desired path of the respective data files to the data in analysis of the .spec file.

I have tried the solution proposed in this question, but after packaging I get an error app name returned -1. Furthermore, packaging to one file works fine when not including the code proposed by this answer, again missing the html, js, and css I need.

Has anyone run into this issue with pyinstaller 3.1.1 that has a fix?

Thanks in advance for any help!

Upvotes: 3

Views: 1605

Answers (1)

Grr
Grr

Reputation: 16079

So I ended up solving this one for myself. After reading through the docs again I noticed that here is a small blurb that says in one file mode the exe will create a temp folder named MEIPASS this is the folder referenced in the answer I linked. However, in my case as I have multiple data files that are swapped out in my app I had to change all of the references to those files to call sys._MEIPASS+ '/' + file instead of the QDir.currentPath() + '/' + file I had been using (This app was built using PyQt4).

Furthermore, for the CSS and js files associated with my html I had to make sure that the href calls where in the same folder.

Upvotes: 1

Related Questions