0
與IPython的Qt的外殼採用的代碼是這樣的我的應用程序接口:如何獲取sys.exc_traceback表單IPython shell.run_code?
from IPython.core.interactiveshell import ExecutionResult
shell = self.kernelApp.shell # ZMQInteractiveShell
code = compile(script, file_name, 'exec')
result = ExecutionResult()
shell.run_code(code, result=result)
if result:
self.show_result(result)
的問題是:如何show_result可以顯示在代碼中的異常引起的追溯?
ExecutionResult的error_before_exec
和error_in_exec
ivars似乎都沒有提供對回溯的引用。同樣,sys
和shell.user_ns.namespace.get('sys')
都沒有sys.exc_traceback
屬性。
任何想法?謝謝!
愛德華