【发布时间】:2015-01-24 16:07:18
【问题描述】:
我问这个问题是因为我无法解决 Python/Django 中的一个问题(实际上在纯 Python 中没问题),这导致 RuntimeError: tcl_asyncdelete async handler deleted by the wrong thread。这在某种程度上与我在 Django 中渲染matplotlib 绘图的方式有关。我的做法是:
...
import matplotlib.pyplot as plt
...
fig = plt.figure()
...
plt.close()
我极大地减少了我的代码。但问题是——即使我只有一行代码:
fig = plt.figure()
我看到这个 RuntimeError 发生了。我希望我能解决这个问题,如果我知道在 Python/Django 中关闭/清理/销毁绘图的正确方法。
【问题讨论】:
-
你能发布回溯吗?
-
我在 Pyramid 1.3.4 / Python 2.7 中遇到了同样的问题,仅此而已 - Exception RuntimeError: RuntimeError('main thread is not in main loop',) in
> 的方法 PhotoImage.__del__ 忽略 Tcl_AsyncDelete: 异步处理程序被错误的线程删除
标签: python django matplotlib