1

I am trying to add exactly eight .png files and one .json file to a .app I am trying to create using PyInstaller, or, if I have to, I can use Py2App. The program I am trying to turn to a .app is a tkinter GUI application, if that's relevant in any way.

With PyInstaller I can get the .app to form correctly by doing

pyi-makespec --windowed --icon myicon.icns myapp.py

then adding the files under the datas attribute in the .spec file, and then finally doing

pyinstaller myapp.spec

However, when I run the program its raising a python error saying it can't locate the files, even though I checked inside the .app and they are there. While troubleshooting, I tried doing print(os.getcwd()) and it said it was in /User/Robert, which I presume is the problem (the .app is not located in that directory).

As for using Py2App, I can't even figure out how to properly add the files. I tried

py2applet --make-setup --iconfile myicon.icns myapp.py

and then added all their paths within the generated DATA_FILES list, but I just get an error while it is forming the .app after executing

python3 setup.py py2app

So if anybody knows how I can form a .app file from a tkinter application that makes use of certain files, it would be greatly appreciated.

Thanks in advance.

PS: I am using python 3.5.1 (for both the .py file being converted and the conversion process) and my mac OS X version is 10.11, if that helps in any way.

PPS: I have been able to get this exact same program to work on windows in the form of a .exe (converted using PyInstaller).

RobertR
  • 745
  • 9
  • 27
  • You might want to post your `spec` file, as there could be some clues there. – l'L'l Jun 23 '16 at 06:33
  • @l'L'l I've added a link to a pastebin containing the `.spec` file's content. – RobertR Jun 23 '16 at 06:41
  • The one strange thing about your `app = BUNDLE` statement is it's using a `coll` instead of `exe`... maybe try changing that. Also you might want to define a workpath in your `pyi-makespec` command and set the icon like `--icon=myicon.icns`... – l'L'l Jun 23 '16 at 06:51
  • @l'L'l Ok, I'll give that a try. How do I define a workpath? – RobertR Jun 23 '16 at 06:54
  • It would be the directory that you are building from `–workpath=/path/of/files/to/build`... it's not really necessary. but it might help find the files. – l'L'l Jun 23 '16 at 06:56

0 Answers0