Skip to content
Advertisement

Problem turning python file into an app using py2app

So I am trying to turn my code: https://github.com/TheLostProgrammer/Video_Downloader/blob/main/Video_Downloader.py 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 setup.py:

from setuptools import setup

APP = ['Converter.py']
DATA_FILES = []
OPTIONS = {
 'iconfile': 'AppIcon.icns',
 'argv_emulation': True,
 'packages': ['certifi'],
}

setup(
    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 setup.py 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?

Advertisement

Answer

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.

Advertisement