Problem turning python file into an app using py2app

Tags: ,

So I am trying to turn my code: Into an .app file using py2app so I can use it on my mac…

Every time I go to open the .app file it opens and then immediately closes.

Here is the contents of my

from setuptools import setup

APP = ['']
 'iconfile': 'AppIcon.icns',
 'argv_emulation': True,
 'packages': ['certifi'],

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

These are the steps that I have done in my terminal to turn the .py file into .app:

pip3.9 install virtualenv 
virtualenv venv --system-site-packages
source venv/bin/activate   
pip3.9 install py2app==0.19
python3 py2app

After all of this, in my home folder is the dist file and within is the .app file. When I open the .app file it closes immediately.

I have tried to find an answer for this happening but none of the answers I have found have worked. I have also read through the documentation for py2app but I still have no idea how to fix this. Can someone please help?


Okay… So after adding Try: and Except: to my code to find where the error was I found out it was one of my modules… Also, I moved from py2app over to pyinstaller as it is an easier process.

Source: stackoverflow