OSX 10.11 with py2app?

716 views Asked by At

I'm trying to build a standalone osx app with py2app that runs a gui I wrote. Since I wasn't able to do so I decided to check whether I was able to build a standalone osx app at all (a really basic one).

So I used this tutorial: https://www.metachris.com/2015/11/create-standalone-mac-os-x-applications-with-python-and-py2app/

Everything seems to go right until i try to run my app in alias mode like this:

$ ./dist/Sandwich.app/Contents/MacOS/Sandwich

I get the following message saying:

$ ./dist/Sandwich.app/Contents/MacOS/Sandwich
Dec 28 01:48:51  Sandwich[48299] <Notice>: Traceback (most recent call 
last):
Dec 28 01:48:51  Sandwich[48299] <Notice>:   File 
"/Users/username/Sandwich/dist/Sandwich.app/Contents/Resources/__boot__.py", line 376, in <module>
Dec 28 01:48:51  Sandwich[48299] <Notice>:     _run()
Dec 28 01:48:51  Sandwich[48299] <Notice> File"
/Users/username/Sandwich/dist/Sandwich.app/Contents/Resources/__boot__.py", line 361, in _run
Dec 28 01:48:51  Sandwich[48299] <Notice>:     with open(script, 'rU') as fp:
Dec 28 01:48:51  Sandwich[48299] <Notice>: IOError: [Errno 2] No such file or directory: '/Users/username/Sandwich/Sandwich.py'
Dec 28 01:48:51  Sandwich[48299] <Notice>: 2016-12-28 01:48:51.258 Sandwich[48299:2126424] Sandwich Error

Q: What do I need to do in order to succesfully create a OSX standalone app from here? The documentation on py2app is quite minimalistic and I can't find anyone with the same problem.

I would really appreciate the help! I've been trying to build an osx standalone app for a week now. Thanks in advance!

2

There are 2 answers

0
Deem On

I'm not sure if this is your problem, but I had a similar issue which I managed to fix by doing the following:

Py2app: Operation not permitted

followed by running

python3 setup.py py2app

. I'm not much of an expert, but with those two steps I just managed to get my own GUI app working.

Additionally, if you still encounter errors, you may want to try building a non-alias version (just exclude the -A flag), and running the app that is generated in /dist. It will probably error - there is an option to see the error in terminal, which may give you a hint as to what exactly is going wrong.

0
Ajax1234 On

Try this:

In the directory of Sandwich.py (or whatever code you are using), type this:

    py2applet --make-setup Sandwich.py

Then, in that directory, you will find a setup.py file, which you can customize with an icon, etc. Once you are satisfied with the setup.py file, run this command to build the app:

    python setup.py py2app -A

I hope that helps!