I was trying to convert my python script test.py to a mac app.
I followed this tutorial.
Content of test.py
print("Hello world!")
Then I created setup.py with the following content and saved in to the same folder as test.py:
from setuptools import setup
APP = ['test.py']
OPTIONS = {'argv_emulation': True}
setup(app=APP, options={'py2app':OPTIONS},setup_requires=['py2app'])
Then I navigated my terminal to the folder where test.py and setup.py are stored.
Then I installed py2app with the following command(I am using Pycharm):
pip3 install py2app
Then I entered the following terminal command:
python setup.py py2app
py2app performed multiple operations and responded with
Done!
I navigated back to the directory where test.py and setup.py are stored.
As expected, I found new directories: build and dist.
I opened the dist directory and found a file test.app there.
I double clicked test.app, an icon popped in the dock, bounced for few times, and disappeared.
*I did this with the simplest python script possible in order to figure out what the problem is. I tried to create and app from a more complex script before, in that case after double clicking the {}.app file a window poped app saying
{file name} encountered and error
and let me choose to either terminate the app directly or see the console.
Please what am I doing wrong / is there a straightforward way to turn a py script into a mac app?
Many thanks