「matplotlibとthreadの相性」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
なんとなくmatplotlibを複数の画面で表示したくなったので
ThreadPoolを作って、同じグラフを複数表示!と考えていたのですが
どうもmatplotlibはThreadSafeではないようです。
PGはPython Cook Bookのスレッドプールサンプルを使い、
下みたいな感じに修正。(さすがに全ソースはのせられない。。。)
try:
if command == 'process':
#result = 'new' + item
#mythread()内でsubplot()を呼ぶ
result = mythread() + item
else:
raise ValueError,'Unknown command %r' % command
except:
print 'error raised!'
#report_error()
traceback.print_exc()
えーー、見事に止まってくださいました。
しょーがねーなーと思い、1回に1度だけ実行させるようにして
再度実行。
Fatal Python error: PyEval_RestoreThread: NULL tstate
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
むっきゃーーーーーー(のだめ風)
ってわけで、matplotlibは、1回に1度だけ、1プロセス上で使うことをおすすめ。
(って、適当に試しただけなので、しっかり改造すればできるかも)
なんとなくmatplotlibを複数の画面で表示したくなったので
ThreadPoolを作って、同じグラフを複数表示!と考えていたのですが
どうもmatplotlibはThreadSafeではないようです。
PGはPython Cook Bookのスレッドプールサンプルを使い、
下みたいな感じに修正。(さすがに全ソースはのせられない。。。)
try:
if command == 'process':
#result = 'new' + item
#mythread()内でsubplot()を呼ぶ
result = mythread() + item
else:
raise ValueError,'Unknown command %r' % command
except:
print 'error raised!'
#report_error()
traceback.print_exc()
えーー、見事に止まってくださいました。
しょーがねーなーと思い、1回に1度だけ実行させるようにして
再度実行。
Fatal Python error: PyEval_RestoreThread: NULL tstate
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
むっきゃーーーーーー(のだめ風)
ってわけで、matplotlibは、1回に1度だけ、1プロセス上で使うことをおすすめ。
(って、適当に試しただけなので、しっかり改造すればできるかも)