當我導入Theano時,我無法讓PyCharm在引發異常的代碼行停止。PyCharm中斷異常無法與Theano配合使用
我的代碼:
import theano
raise Exception()
我希望PyCharm調試器停在raise Exception()
線,但它拋出一個RuntimeError
和退出調試程序:
Traceback (most recent call last):
Error in sys.excepthook:
Traceback (most recent call last):
File "/homes/user/Downloads/pycharm-community-4.5.1/helpers/pydev/pydevd_breakpoints.py", line 89, in _excepthook
_original_excepthook(exctype, value, tb)
File "/usr/local/lib/python2.7/dist-packages/theano/gof/link.py", line 58, in thunk_hook
__excepthook(type, value, trace)
File "/homes/user/Downloads/pycharm-community-4.5.1/helpers/pydev/pydevd_breakpoints.py", line 89, in _excepthook
_original_excepthook(exctype, value, tb)
File "/usr/local/lib/python2.7/dist-packages/theano/gof/link.py", line 58, in thunk_hook
__excepthook(type, value, trace)
<...>
File "/usr/local/lib/python2.7/dist-packages/theano/gof/link.py", line 58, in thunk_hook
__excepthook(type, value, trace)
File "/homes/user/Downloads/pycharm-community-4.5.1/helpers/pydev/pydevd_breakpoints.py", line 84, in _excepthook
exception_breakpoint = get_exception_breakpoint(exctype, _handle_exceptions)
File "/homes/user/Downloads/pycharm-community-4.5.1/helpers/pydev/pydevd_breakpoints.py", line 65, in get_exception_breakpoint
exception_full_qname = get_exception_full_qname(exctype)
File "/homes/user/Downloads/pycharm-community-4.5.1/helpers/pydev/pydevd_breakpoints.py", line 53, in get_exception_full_qname
def get_exception_full_qname(exctype):
RuntimeError: maximum recursion depth exceeded
Original exception was:
Traceback (most recent call last):
File "/homes/user/Downloads/pycharm-community-4.5.1/helpers/pydev/pydevd.py", line 2357, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/homes/user/Downloads/pycharm-community-4.5.1/helpers/pydev/pydevd.py", line 1777, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/homes/user/corp/python/projects/n_test.py", line 10, in <module>
raise Exception()
Exception
通常,當python全局解釋器遞歸編譯theano代碼超過允許值時,會發生'RuntimeError:超過最大遞歸深度'。爲什麼它會在導入時發生,我不知道,但是您可以將最大深度設置爲更大(1e6)的數字,然後查看是否有幫助。 – user2805751
嘗試更新點子。在執行'sudo -H pip install --upgrade pip'之前,我有同樣的錯誤。我使用'sudo -H',因爲它在OSX 10.11.2上。 – Znatz