Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Py2app: Operation not permitted

I want to create an application called 'dodgeball' and I have my main script (which uses pygame), and my setup.py script. I need an image named ball.bmp that I need as well.

Inside my setup.py script I have the following code: from setuptools import setup

APP = ['dodgeball.py']
DATA_FILES = ["ball.bmp"]
OPTIONS = {'argv_emulation': True}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

Whenever I try to make the application using the following stuff in Terminal:

python setup.py py2app

everything works up to

*** creating application bundle: dodgeball ***

then it returns an error:

error: [Errno 1] Operation not permitted: '/Users/**********/Desktop/Dodgeball/dist/dodgeball.app/Contents/MacOS/dodgeball'

If it helps, I'm on Mac OS X El Capitan (10.11). I'm aware that El Capitan, like any Apple update, will have new software and features that may break stuff like this.

QUESTION

How do I fix this error and then allow py2app to make a fully functionable app?

like image 919
SirSmokes Avatar asked Oct 18 '15 11:10

SirSmokes


2 Answers

I had the same problem. Instead of running

python setup.py py2app

I tried

python3 setup.py py2app

and it worked just fine. Hope this helps.

like image 111
codaholic Avatar answered Nov 15 '22 20:11

codaholic


Solution: Install with -U flag!

Since all of you will have installed py2app already, start by uninstalling it.

pip3 uninstall py2app

After this point, it's crucial that you reinstall it using the -U flag! 📦

pip3 install -U py2app
py2applet --make-setup YourApp.py
python3 setup.py py2app -A

Look in your dist/ folder, there should now be a runnable application.

Then you can rebuild it using python3 setup.py py2app

Verified on OS X Catalina, Mojave, Big Sur

like image 29
Joel Avatar answered Nov 15 '22 20:11

Joel