1

我正在开发一个 python 应用程序,它在应用程序中包含一个 CEFPython3 浏览器。该应用程序正在正确编译,当我运行 our_app.py 时,一切正常。但是当我用 py2app 打包它时,我得到了这些错误。究竟是什么问题?我尝试搜索其他线程,但每个用户似乎都有不同的问题。

注意:在我们的应用程序中,我们将 CEFPython3 的 GPU 标志设置为disable-gpu=true

错误日志:

{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf200
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww28600\viewh15000\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0

\f0\fs24 \cf0 May 24 13:04:48 Akshays-MacBook-Air syslogd[46]: ASL Sender Statistics\
May 24 13:05:28 Akshays-MacBook-Air com.apple.xpc.launchd[1] (org.pythonmac.unspecified.APP_NAME.12348[954]): Service exited with abnormal code: 255\
May 24 13:05:37 Akshays-MacBook-Air sudo[964]: akshaysulakhe : TTY=ttys000 ; PWD=/Users/akshaysulakhe/Downloads/APP_NAMEwx ; USER=root ; COMMAND=/sbin/dmesg\
May 24 13:05:51 Akshays-MacBook-Air sudo[971]: akshaysulakhe : TTY=ttys000 ; PWD=/Users/akshaysulakhe/Downloads/APP_NAMEwx ; USER=root ; COMMAND=/sbin/dmesg\
May 24 13:06:09 Akshays-MacBook-Air com.apple.xpc.launchd[1] (com.apple.quicklook[973]): Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.quicklook\
May 24 13:07:04 Akshays-MacBook-Air sudo[974]: akshaysulakhe : TTY=ttys000 ; PWD=/Users/akshaysulakhe/Downloads/APP_NAMEwx ; USER=root ; COMMAND=/bin/launchctl remove com.cylance.agent_service\
May 24 13:07:10 Akshays-MacBook-Air com.apple.xpc.launchd[1] (org.pythonmac.unspecified.APP_NAME.12352[966]): Service exited with abnormal code: 255\
May 24 13:07:14 Akshays-MacBook-Air com.apple.xpc.launchd[1] (org.pythonmac.unspecified.APP_NAME.12356[976]): Service exited with abnormal code: 255\
May 24 13:07:19 Akshays-MacBook-Air com.apple.xpc.launchd[1] (com.apple.quicklook[981]): Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.quicklook\
May 24 13:07:35 Akshays-MacBook-Air com.apple.xpc.launchd[1] (org.pythonmac.unspecified.APP_NAME.12356[987]): Service exited with abnormal code: 255\
May 24 13:08:30 Akshays-MacBook-Air com.apple.xpc.launchd[1] (com.apple.quicklook[992]): Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.quicklook\
May 24 13:09:27 Akshays-MacBook-Air TextEdit[993]: assertion failed: 17D102: libxpc.dylib + 72637 [F7E5F1BC-614B-39CB-B6CE-92A9C7B7EC0B]: 0x89\
May 24 13:09:28 Akshays-MacBook-Air com.apple.xpc.launchd[1] (com.apple.imfoundation.IMRemoteURLConnectionAgent): Unknown key for integer: _DirtyJetsamMemoryLimit\
May 24 13:12:19 Akshays-MacBook-Air com.apple.xpc.launchd[1] (com.apple.imfoundation.IMRemoteURLConnectionAgent): Unknown key for integer: _DirtyJetsamMemoryLimit\
}

崩溃日志:

{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf200
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0

\f0\fs24 \cf0 Process:               APP_NAME [846]\
Path:                  /Users/USER/Downloads/*/APP_NAME.app/Contents/MacOS/APP_NAME\
Identifier:            org.pythonmac.unspecified.APP_NAME\
Version:               0.0.0 (0.0.0)\
Code Type:             X86-64 (Native)\
Parent Process:        ??? [1]\
Responsible:           APP_NAME [846]\
User ID:               501\
\
Date/Time:             2018-05-24 12:44:16.609 +0530\
OS Version:            Mac OS X 10.13.3 (17D102)\
Report Version:        12\
Anonymous UUID:        83F4A79A-60D6-23EF-2BDC-2B052BA014A7\
\
Sleep/Wake UUID:       CE376F54-DDE9-4CB5-960D-A08762CAFD0C\
\
Time Awake Since Boot: 7900 seconds\
Time Since Wake:       1900 seconds\
\
System Integrity Protection: enabled\
\
Crashed Thread:        0  Dispatch queue: com.apple.main-thread\
\
Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)\
Exception Codes:       0x0000000000000001, 0x0000000000000000\
Exception Note:        EXC_CORPSE_NOTIFY\
\
Termination Signal:    Illegal instruction: 4\
Termination Reason:    Namespace SIGNAL, Code 0x4\
Terminating Process:   exc handler [0]\
\
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread\
0   org.chromium.ContentShell.framework 0x0000000107e5e1f7 0x106a38000 + 21127671\
1   org.chromium.ContentShell.framework 0x0000000107e87e4e 0x106a38000 + 21298766\
2   org.chromium.ContentShell.framework 0x0000000107e87c44 0x106a38000 + 21298244\
3   org.chromium.ContentShell.framework 0x0000000106a3a2c4 cef_initialize + 276\
4   cefpython_py36.so               0x0000000106931213 CefInitialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, scoped_refptr<CefApp>, void*) + 163\
5   cefpython_py36.so               0x00000001068d20ff __pyx_pf_14cefpython_py36_22Initialize(_object*, _object*, _object*, _object*) + 43535\
6   cefpython_py36.so               0x00000001068c74d4 __pyx_pw_14cefpython_py36_23Initialize(_object*, _object*, _object*) + 164\
7   org.python.python               0x0000000101867685 _PyCFunction_FastCallDict + 229\
8   org.python.python               0x00000001018678a8 _PyCFunction_FastCallKeywords + 136\
9   org.python.python               0x00000001018f05e4 call_function + 612\
10  org.python.python               0x00000001018f2506 _PyEval_EvalFrameDefault + 6918\
11  org.python.python               0x00000001018f032e fast_function + 606\

                                VIRTUAL   REGION \
REGION TYPE                        SIZE    COUNT (non-coalesced) \
===========                     =======  ======= \
Activity Tracing                   256K        2 \
CoreUI image file                  116K        2 \
Kernel Alloc Once                    8K        2 \
MALLOC                            52.9M       46 \
MALLOC guard page                   32K        9 \
MALLOC_LARGE (reserved)            512K        3         reserved VM address space (unallocated)\
STACK GUARD                       56.0M        7 \
Stack                             10.5M        7 \
VM_ALLOCATE                         40K        4 \
__DATA                            40.6M      321 \
__FONT_DATA                          4K        2 \
__LINKEDIT                       201.1M       36 \
__TEXT                           329.0M      319 \
__UNICODE                          560K        2 \
mapped file                       33.5M        5 \
shared memory                      628K       10 \
===========                     =======  ======= \
TOTAL                            725.8M      761 \
TOTAL, minus reserved VM space   725.3M      761 \
\
}

setup.py 来自 py2app :

from setuptools import setup

APP = ['Our_APP.py']
DATA_FILES = []
OPTIONS = {}

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

1 回答 1

1

查看 wxpython.py 示例中如何处理退出代码 255:

if MAC:
        # On Mac things work differently, other steps are required
        self.browser.CloseBrowser()
        self.clear_browser_references()
        self.Destroy()
        global g_count_windows
        g_count_windows -= 1
        if g_count_windows == 0:
            cef.Shutdown()
            wx.GetApp().ExitMainLoop()
            # Call _exit otherwise app exits with code 255 (Issue #162).
            # noinspection PyProtectedMember
            os._exit(0)

完整来源: https ://github.com/cztomczak/cefpython/blob/2fb9ae156802c12b9941f61661318386dbf3bfe2/examples/wxpython.py#L167

跟踪器中的相应问题: https ://github.com/cztomczak/cefpython/issues/162

于 2018-05-24T09:04:06.460 回答