BXIA
BXIA

Reputation: 61

py2app app crashes with PyQt5

When I was building my python standalone app with command python setup.py py2app, the output package fails to start. However, if I build with hot link python setup.py py2app -A, it works fine.

I used PyQt for my app, maybe that causes the problem.

Here's my setup.py:

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

Usage:
    python setup.py py2app
"""

from setuptools import setup

APP = ['teammaker.py']
DATA_FILES = ['ui.py']
OPTIONS = {'argv_emulation': True, 'includes':['sip','PyQt5','PyQt5.QtWidgets']}

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

and here's my crash log.

Please help to find out the problem, thank you!

Upvotes: 4

Views: 1637

Answers (1)

user6911880
user6911880

Reputation: 1

I had a similar problem with my Text Editor. The solution I found here. In short:

  1. Open the boot.py file inside the dist/name_of_your_program.app/Contents/Resources folder in any text editor (Finder might not show the .app file extension).
  2. Find a function def _run()
  3. Under the import statement add the following line:

    sys.path = [os.path.join(os.environ['RESOURCEPATH'], 'lib', 'python2.6', 'lib-dynload')] + sys.path

You need to change the 'python2.6' into the actual Python version you use. 'python3' worked for me.

Upvotes: -2

Related Questions