简体   繁体   中英

Tkinter moviepy issue

On Mac OS 10.11 in python I get an abort trap when doing:

from moviepy.editor import *
from Tkinter import *
root = Tk()

The abort trap looks like:

2016-01-27 16:01:24.723 Python[13070:104308] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7ffa632d9bd0
2016-01-27 16:01:24.724 Python[13070:104308] An uncaught exception was raised
2016-01-27 16:01:24.724 Python[13070:104308] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7ffa632d9bd0
2016-01-27 16:01:24.724 Python[13070:104308] (
    0   CoreFoundation                      0x00007fff933e4ae2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff92bdb73c objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff933e7b9d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00007fff93320601 ___forwarding___ + 1009
    4   CoreFoundation                      0x00007fff93320188 _CF_forwarding_prep_0 + 120
    5   Tk                                  0x0000000110f42958 TkpInit + 476
    6   Tk                                  0x0000000110ebda7e Tk_Init + 1799
    7   _tkinter.so                         0x000000010cdb8b9d Tcl_AppInit + 82
    8   _tkinter.so                         0x000000010cdb8547 Tkinter_Create + 1120
    9   Python                              0x0000000108de7bcd PyEval_EvalFrameEx + 26858
    10  Python                              0x0000000108de10f1 PyEval_EvalCodeEx + 1583
    11  Python                              0x0000000108d85fb1 function_call + 352
    12  Python                              0x0000000108d67eb0 PyObject_Call + 99
    13  Python                              0x0000000108d72cb8 instancemethod_call + 173
    14  Python                              0x0000000108d67eb0 PyObject_Call + 99
    15  Python                              0x0000000108deb06f PyEval_CallObjectWithKeywords + 165
    16  Python                              0x0000000108d70f5c PyInstance_New + 126
    17  Python                              0x0000000108d67eb0 PyObject_Call + 99
    18  Python                              0x0000000108de7a27 PyEval_EvalFrameEx + 26436
    19  Python                              0x0000000108de10f1 PyEval_EvalCodeEx + 1583
    20  Python                              0x0000000108de0abc PyEval_EvalCode + 54
    21  Python                              0x0000000108e04ea1 run_mod + 53
    22  Python                              0x0000000108e04ccc PyRun_InteractiveOneFlags + 377
    23  Python                              0x0000000108e047c5 PyRun_InteractiveLoopFlags + 192
    24  Python                              0x0000000108e0466f PyRun_AnyFileExFlags + 60
    25  Python                              0x0000000108e16445 Py_Main + 3137
    26  libdyld.dylib                       0x00007fff916435ad start + 1
    27  ???                                 0x0000000000000001 0x0 + 1
)
2016-01-27 16:01:24.725 Python[13070:104308] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7ffa632d9bd0'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff933e4ae2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff92bdb73c objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff933e7b9d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00007fff93320601 ___forwarding___ + 1009
    4   CoreFoundation                      0x00007fff93320188 _CF_forwarding_prep_0 + 120
    5   Tk                                  0x0000000110f42958 TkpInit + 476
    6   Tk                                  0x0000000110ebda7e Tk_Init + 1799
    7   _tkinter.so                         0x000000010cdb8b9d Tcl_AppInit + 82
    8   _tkinter.so                         0x000000010cdb8547 Tkinter_Create + 1120
    9   Python                              0x0000000108de7bcd PyEval_EvalFrameEx + 26858
    10  Python                              0x0000000108de10f1 PyEval_EvalCodeEx + 1583
    11  Python                              0x0000000108d85fb1 function_call + 352
    12  Python                              0x0000000108d67eb0 PyObject_Call + 99
    13  Python                              0x0000000108d72cb8 instancemethod_call + 173
    14  Python                              0x0000000108d67eb0 PyObject_Call + 99
    15  Python                              0x0000000108deb06f PyEval_CallObjectWithKeywords + 165
    16  Python                              0x0000000108d70f5c PyInstance_New + 126
    17  Python                              0x0000000108d67eb0 PyObject_Call + 99
    18  Python                              0x0000000108de7a27 PyEval_EvalFrameEx + 26436
    19  Python                              0x0000000108de10f1 PyEval_EvalCodeEx + 1583
    20  Python                              0x0000000108de0abc PyEval_EvalCode + 54
    21  Python                              0x0000000108e04ea1 run_mod + 53
    22  Python                              0x0000000108e04ccc PyRun_InteractiveOneFlags + 377
    23  Python                              0x0000000108e047c5 PyRun_InteractiveLoopFlags + 192
    24  Python                              0x0000000108e0466f PyRun_AnyFileExFlags + 60
    25  Python                              0x0000000108e16445 Py_Main + 3137
    26  libdyld.dylib                       0x00007fff916435ad start + 1
    27  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

moviepy is the latest version (0.2.2.11), Tkinter is the recommended build from the Tcl/Tk website. I also notice that when I import moviepy.editor a Tkinter symbol pops up in the dock as if a Tk() object is being instantiated by moviepy? Very strange, very frustrating.

Fixed. Turns out this is a weird issue with matplotlib. Doing:

import matplotlib
matplotlib.use('TkAgg')

does the trick. There are some other questions, on this website, where this abort trap has appeared, and perhaps this all that need be done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM