16

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?

jl.da
  • 627
  • 1
  • 11
  • 30
  • 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. However, the animation which I expected and works on Windows, does not appear, it only appears a black window. – jl.da Jun 18 '14 at 15:16
  • 1
    I think it would be great to update the main question with this info and close this question. Then people know what to do if they run into it. Regarding the animation not working, you could post a new question on that specifically, of course posting a short code which replicates the error (works on Windows but not on mac). – Jonas Lindeløv Jun 18 '14 at 17:40

5 Answers5

12

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
Gander
  • 1,854
  • 1
  • 23
  • 30
Jainam
  • 153
  • 1
  • 11
12

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.)

Rockallite
  • 16,437
  • 7
  • 54
  • 48
  • This is exactly what I needed to find out what was causing the problem for me. I was still getting these aborts even though I tried using `brew` to `switch` my `openssl` versions. It is also funny to see my problem also stems from the `asn1crypto` package. – Karthic Raghupathi Jun 12 '20 at 20:49
1

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.

jl.da
  • 627
  • 1
  • 11
  • 30
  • 1
    You haven't told us what you mean by using a "pyglet animation" nor the way in which it "doesn't work". We can't help you with so little detail. Code and/or error information is essential to get any useful answer – Jon Jun 20 '14 at 10:37
  • @Jon, I have posted [another question](http://stackoverflow.com/questions/24324985/pyglet-script-works-in-windows-but-not-in-osx) regarding the animation, thank you for your feedback. – jl.da Jun 20 '14 at 10:41
  • 1
    Have you tried changing your matplotlib backed to TkAgg? matplotlib.use('TkAgg') – Atul Ingle Jun 15 '16 at 15:40
0

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

Jon
  • 1,198
  • 7
  • 8
  • thanks for the answer. I have finally found why this error appeared. It is because I use TKinter, when I comment out the lines where this library is used, the error does not appear. However, the animation that I expected and works on Windows does not appear. Therefore I will follow your advice and start a simple script. – jl.da Jun 18 '14 at 15:17
0

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/openssl@1.1/cert.pem) which I moved to a backup location:

sudo mv /usr/local/etc/openssl@1.1 ~/openssl@1.1-usrlocalbackup

Then reinstalling openssl using brew cured the problem:

brew install openssl