3

I have a python application which I am building using the latest py2app on OSX 10.11.3. The compiled application runs correctly on my Mac and on another Mac 10.10.5, but instantly crashes with "Quit unexpectedly" when opening on another Mac 10.11.3. My question is how do I go about bug fixing something like this, how can I find out exactly what is crashing it? This is the setup.py I am using:

"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup

APP = ['MyAppV1.2.py']
DATA_FILES = []
OPTIONS = {
                   'iconfile':'MyApp.icns',
                   'plist': {'CFBundleShortVersionString':'1.2',}
                   }

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

Anything I am doing wrong, or how can I see whats causing the crash once compiled? Perhaps it's a package which is not being bundled correctly, how can I see what packages are bundled correctly and what are not?

UPDATE:

I did as suggested below and double clicked the exec file of my app name to run in Terminal so I get some sort of error logging. When running my app I now get the below error:

Traceback (most recent call last):
  File "/Applications/MyApp.app/Contents/Resources/__boot__.py", line 72, in <module>
    _setup_ctypes()
  File "/Applications/MyApp.app/Contents/Resources/__boot__.py", line 66, in _setup_ctypes
    from ctypes.macholib import dyld
ImportError: No module named ctypes.macholib

I don't know where to go from here, what can I do to try and fix this issue please?

speedyrazor
  • 3,127
  • 7
  • 33
  • 51
  • Thank you for the help, guys. I was running into the same issue only to determine I was trying to import I library I no longer needed. Once I looked at the packages (right click -> Show Package Contents), I was able to determine that. – Ivo Vachkov Mar 21 '20 at 21:36

2 Answers2

3

Your setup file seems to look ok. What you can do to debug py2app packaged apps, is...

  1. Right click on your packaged .app > "Show Package Contents"
  2. Go into Contents > MacOS
  3. Double click the exec file of your app name

This will open your app with the terminal console window, so you can debug whats causing the app to crash.

Andy92
  • 141
  • 1
  • 11
  • Hi, thanks for you reply, I have added an update above to the original question, so have some error log info, but not sure how to fix. – speedyrazor Apr 21 '16 at 14:12
  • Check out the bootstrap_modules setting. More info here: http://stackoverflow.com/questions/23970240/how-to-stop-python-program-compiled-in-py2exe-from-displaying-importerror-no-mo – Andy92 Apr 22 '16 at 14:02
  • That is for windows py2exe, how do I do the same thing on mac for py2app? – speedyrazor Apr 22 '16 at 15:53
0

Apologies, but this turned ou to be a bag configuration issue with my Python install. I did the same build on a different mac, with the same versions of everything, and the app now opens and runs fine on all other macs. Sorry for the false issue.

speedyrazor
  • 3,127
  • 7
  • 33
  • 51