jl.da
jl.da

Reputation: 627

Abort trap: 6 when running a python script

I am working on a python program that displays an animation, thus I am using pyglet. Until now I've been working with the python compiler that comes with Psychopy, but now I need to make this program as most independent as possible.

I have achieved this task with a Windows machine, in the case of OSX, I have followed this post in order to install pyglet. However, when I now run the program, it returns this:

>>>> python 140603_plaid8.py
2014-06-17 12:25:02.512 Python[1713:d07] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/fk/1plt8wj53_d183pv59scmg4m0000gn/T/org.python.python.savedState
no input received
CONFIG FILE LOADED
TRIALS FILE LOADED
2014-06-17 12:25:02.661 Python[1713:d07] -[NSApplication _setup:]: unrecognized selector sent to instance 0x102d3b5c0
2014-06-17 12:25:02.662 Python[1713:d07] An uncaught exception was raised
2014-06-17 12:25:02.663 Python[1713:d07] -[NSApplication _setup:]: unrecognized selector sent to instance 0x102d3b5c0
2014-06-17 12:25:02.663 Python[1713:d07] (
    0   CoreFoundation                      0x00007fff8948f25c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff87f16e75 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8949212d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00007fff893ed322 ___forwarding___ + 1010
    4   CoreFoundation                      0x00007fff893ecea8 _CF_forwarding_prep_0 + 120
    5   Tk                                  0x0000000108253ed6 TkpInit + 459
    6   Tk                                  0x00000001081d1b0f Tk_Init + 1687
    7   _tkinter.so                         0x00000001080b4c0d Tcl_AppInit + 77
    8   _tkinter.so                         0x00000001080b3657 Tkinter_Create + 919
    9   Python                              0x00000001000c2fad PyEval_EvalFrameEx + 21405
    10  Python                              0x00000001000c4fb3 PyEval_EvalCodeEx + 2115
    11  Python                              0x000000010003eac0 function_call + 176
    12  Python                              0x000000010000ceb2 PyObject_Call + 98
    13  Python                              0x000000010001f56d instancemethod_call + 365
    14  Python                              0x000000010000ceb2 PyObject_Call + 98
    15  Python                              0x00000001000bc957 PyEval_CallObjectWithKeywords + 87
    16  Python                              0x000000010002285e PyInstance_New + 126
    17  Python                              0x000000010000ceb2 PyObject_Call + 98
    18  Python                              0x00000001000c0c60 PyEval_EvalFrameEx + 12368
    19  Python                              0x00000001000c4fb3 PyEval_EvalCodeEx + 2115
    20  Python                              0x000000010003eac0 function_call + 176
    21  Python                              0x000000010000ceb2 PyObject_Call + 98
    22  Python                              0x000000010001f56d instancemethod_call + 365
    23  Python                              0x000000010000ceb2 PyObject_Call + 98
    24  Python                              0x00000001000bc957 PyEval_CallObjectWithKeywords + 87
    25  Python                              0x000000010002285e PyInstance_New + 126
    26  Python                              0x000000010000ceb2 PyObject_Call + 98
    27  Python                              0x00000001000c0c60 PyEval_EvalFrameEx + 12368
    28  Python                              0x00000001000c4fb3 PyEval_EvalCodeEx + 2115
    29  Python                              0x00000001000c50d6 PyEval_EvalCode + 54
    30  Python                              0x00000001000e995e PyRun_FileExFlags + 174
    31  Python                              0x00000001000e9bfa PyRun_SimpleFileExFlags + 458
    32  Python                              0x0000000100100c0d Py_Main + 3101
    33  Python                              0x0000000100000f14 Python + 3860
    34  ???                                 0x0000000000000002 0x0 + 2
)
2014-06-17 12:25:02.664 Python[1713:d07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x102d3b5c0'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff8948f25c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff87f16e75 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8949212d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00007fff893ed322 ___forwarding___ + 1010
    4   CoreFoundation                      0x00007fff893ecea8 _CF_forwarding_prep_0 + 120
    5   Tk                                  0x0000000108253ed6 TkpInit + 459
    6   Tk                                  0x00000001081d1b0f Tk_Init + 1687
    7   _tkinter.so                         0x00000001080b4c0d Tcl_AppInit + 77
    8   _tkinter.so                         0x00000001080b3657 Tkinter_Create + 919
    9   Python                              0x00000001000c2fad PyEval_EvalFrameEx + 21405
    10  Python                              0x00000001000c4fb3 PyEval_EvalCodeEx + 2115
    11  Python                              0x000000010003eac0 function_call + 176
    12  Python                              0x000000010000ceb2 PyObject_Call + 98
    13  Python                              0x000000010001f56d instancemethod_call + 365
    14  Python                              0x000000010000ceb2 PyObject_Call + 98
    15  Python                              0x00000001000bc957 PyEval_CallObjectWithKeywords + 87
    16  Python                              0x000000010002285e PyInstance_New + 126
    17  Python                              0x000000010000ceb2 PyObject_Call + 98
    18  Python                              0x00000001000c0c60 PyEval_EvalFrameEx + 12368
    19  Python                              0x00000001000c4fb3 PyEval_EvalCodeEx + 2115
    20  Python                              0x000000010003eac0 function_call + 176
    21  Python                              0x000000010000ceb2 PyObject_Call + 98
    22  Python                              0x000000010001f56d instancemethod_call + 365
    23  Python                              0x000000010000ceb2 PyObject_Call + 98
    24  Python                              0x00000001000bc957 PyEval_CallObjectWithKeywords + 87
    25  Python                              0x000000010002285e PyInstance_New + 126
    26  Python                              0x000000010000ceb2 PyObject_Call + 98
    27  Python                              0x00000001000c0c60 PyEval_EvalFrameEx + 12368
    28  Python                              0x00000001000c4fb3 PyEval_EvalCodeEx + 2115
    29  Python                              0x00000001000c50d6 PyEval_EvalCode + 54
    30  Python                              0x00000001000e995e PyRun_FileExFlags + 174
    31  Python                              0x00000001000e9bfa PyRun_SimpleFileExFlags + 458
    32  Python                              0x0000000100100c0d Py_Main + 3101
    33  Python                              0x0000000100000f14 Python + 3860
    34  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

I do not understand what this error means, can anyone help me understand what have I done wrong?

Upvotes: 16

Views: 25474

Answers (5)

Fiskabollen
Fiskabollen

Reputation: 81

I was getting the same failure on importing asn1crypto in Python (on MacOS 10.15.5). Uninstalling then re-installing openssl using brew worked for me:

brew uninstall --ignore-dependencies openssl

brew warned me that there were some files remaining which were not deleted (e.g. /usr/local/etc/[email protected]/cert.pem) which I moved to a backup location:

sudo mv /usr/local/etc/[email protected] ~/[email protected]

Then reinstalling openssl using brew cured the problem:

brew install openssl

Upvotes: 0

Rockallite
Rockallite

Reputation: 16935

Run your Python script like this:

$ PYTHONVERBOSE=3 python your_script.py

Check the last statement before Abort trap: 6, such as:

import asn1crypto._perf._big_num_ctypes # precompiled from ...
Abort trap: 6

Then, run it in a standalone Python interpreter:

$ python
Python 2.7.17 (default, May  6 2020, 10:47:56) 
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.32.59)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import asn1crypto._perf._big_num_ctypes
Abort trap: 6

Then you know that the problem is originated from the asn1crypto module, in this case. Dig into that file and find more...

But for this particular case, just delete the directory of asn1crypto package and try again. (pip uninstall asn1crypto may not work.)

Upvotes: 13

Jainam
Jainam

Reputation: 153

I faced a similar error while using OpenCV. After googling for a while I found out that the error might be with the new macOS. It does not allow un-versioned dylibs to be called. I found the solution here:

https://forums.developer.apple.com/thread/119429

In your terminal:

brew update && brew upgrade && brew install openssl
cd /usr/local/Cellar/openssl/1.0.2t/lib
sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib/
cd /usr/local/lib
sudo ln -s libssl.1.0.0.dylib libssl.dylib
sudo ln -s libcrypto.1.0.0.dylib libcrypto.dylib
pip3 install --upgrade packagename

Upvotes: 12

jl.da
jl.da

Reputation: 627

I have found the reason why this error appears. It is because I use the library TKinter, if I comment out the lines where I use TKinter, this error does not appear and it continues to execute the program.

I will edit this answer when I discover which is the proper way to use TKinter in OSX. But my main concern first is the pyglet animation, which does not work in OSX, but it does in Windows.

Upvotes: 1

Jon
Jon

Reputation: 1223

The error message doesn't tell us very much in this case. What you need to do (in debugging in general) is work out what succeeds and what fails in order to narrow down the problem.

Start with a script that just imports pyglet. If that works then import pyglet and open a window etc...

Report back when you know what line causes the error to occur.

Jon

Upvotes: 0

Related Questions