vendredi 24 juin 2016

Adding data files to a mac .app made from PyInstaller or Py2App

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).

Aucun commentaire:

Enregistrer un commentaire