我正在尝试调试bokeh服务器应用程序。目前,我正在使用pdb,但无法退出python调试器。运行“ q”命令时收到错误消息。
'''
2019-05-10 22:08:08,123 WebSocket connection opened
2019-05-10 22:08:08,124 ServerConnection created
2019-05-10 22:08:08,182 Error thrown from periodic callback:
2019-05-10 22:08:08,192 Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/gen.py", line 883, in callback
result_list.append(f.result())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/gen.py", line 1147, in run
yielded = self.gen.send(value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/bokeh/server/session.py", line 70, in _needs_document_lock_wrapper
result = yield yield_for_all_futures(func(self, *args, **kwargs))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/bokeh/server/session.py", line 191, in with_document_locked
return func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/bokeh/document/document.py", line 1126, in wrapper
return doc._with_self_as_curdoc(invoke)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/bokeh/document/document.py", line 1112, in _with_self_as_curdoc
return f()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/bokeh/document/document.py", line 1125, in invoke
return f(*args, **kwargs)
File "/Users/user/git/my_app/my_app/smooth_simulation.py", line 399, in animate
filter.tree_filtering(z_list, R_list, t)
File "/Users/user/git/my_app/my_app/filter.py", line 489, in tree_filtering
max_node = self.leave_list[np.argmax([n.w for n in self.leave_list])]
File "/Users/user/git/my_app/my_app/filter.py", line 489, in tree_filtering
max_node = self.leave_list[np.argmax([n.w for n in self.leave_list])]
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/bdb.py", line 48, in trace_dispatch
return self.dispatch_line(frame)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/bdb.py", line 67, in dispatch_line
if self.quitting: raise BdbQuit
bdb.BdbQuit
'''
我目前只是用它来解决问题,但这并不是一个方便的解决方案。
'''
import signal; import os; os.kill(os.getpid(), signal.SIGKILL)
'''
感谢您的帮助!
答案 0 :(得分:0)
我在其他异步和网络应用程序中都经历过这种情况。我总是按ctrl-D直到它最终退出。我能想到的唯一其他建议是“硬”退出:
import os; os._exit(0) # notice the underscore