'Why is my py2app app crashing my computer on launch?
I am using py2app .24 on mac OS Mojave (10.14.6), and trying to make a python script into a standalone app. I followed py2app's instructions, using py2applet --make-setup [ALL BUNDLED FILENAMES GO HERE, STARTING WITH MAIN SCRIPT]. I then executed setup.py from terminal (with arguments py2app and --includes=discord because it needs to have the package discord.py installed). It built an app file in my dist folder, as expected. However, when I tried to run the app file, it would bounce a couple times in the dock, and then the computer would crash. The screen would go black and the computer would effectively be forced to restart. I found several others who had the same problem, and the solutions they had were to try running just the application executable from terminal, or bundle everything in a platypus application that runs the main application's executable from terminal (if that makes sense). Running my app from terminal gave me the same result: A crash, and no indication of why (although it did throw an SSL error related to discord which implies that my app code started to run, I can't show you the message because the computer always crashed a split second later). However, bundling it in a platypus application and then running the platypus app gave me the pop up window pictured below (and the app didn't go any further because of the fatal error). I can only imagine this is connected to the crash. I found others who had gotten the same error message from py2app applications, but all of the solutions seemed to be specific: one of them had to do with macOS Catalina, and the other big one had to do with uninstalling Google Drive (which I don't have). It goes without saying that my tkinter code works fine when it's run as a standalone collection of python scripts, so the problem must be somewhere in the building and deployment process that py2app runs. Does the error message pictured below have anything to do with why the app keeps crashing my computer? I'll also put my setup.py file below, because it seems like the problem is in there.
RECAP:
Somewhere during the build process of py2app, something happens to my app that makes it crash my computer every time it is run (and never even finish opening). The two major solutions I found (running it from terminal and bundling it in platypus) don't help.
Possible causes include:
- The strange error popup pictured below, which seems to imply that...
- my
setup.py(which was autocreated by py2app) is missing something important - I'm using an older version of MacOS and the apps created by a newer version of py2app don't mesh well with the older OS (this one isn't likely in my opinion
How might I fix this/what exactly do I need to add to my setup.py file?
RESOURCES:
Setup.py file:
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['Interface.py']
DATA_FILES = ['Uploader.py',
'Downloader.py',
'SplitFile.py',
'currentChoices.json',
'userInfo.json']
OPTIONS = {}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
Thanks in advance, and I can always provide more info if needed (e.g. The modules it said it didn't find when building)!
Solution 1:[1]
I am experiencing the exact same problem. I think this is a bug in py2app. I tried installing different versions of py2app, and when I ran the app, different errors occurred for different versions. As an example, version 0.22 gives a simple error, and I cannot run the program. With version 0.15, no error would be given...the application just would not run at all.
So I think this is something that the py2app developers need to address. But there may be some workaround that I am not aware of.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Johnny Que |

