繁体   English   中英

Tkinter moviepy问题

[英]Tkinter moviepy issue

在python的Mac OS 10.11中,执行以下操作时会出现中止陷阱:

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

中止陷阱看起来像:

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是最新版本(0.2.2.11),Tkinter是Tcl / Tk网站上的推荐构建。 我还注意到,当我导入moviepy.editor时,在坞站中会弹出一个Tkinter符号,就像moviepy正在实例化Tk()对象一样? 很奇怪,很沮丧。

固定。 原来这是matplotlib的怪异问题。 这样做:

import matplotlib
matplotlib.use('TkAgg')

绝招。 在此网站上还有其他一些问题,此中止陷阱已出现在哪里,也许所有这一切都需要完成。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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