我希望我的程序在出现未处理的异常时能够进入交互式控制台模式,但是我不知道如何实现。目前情况下,异常会被报告并立即终止进程。
经过一些搜索,我找到了这篇文章:http://sourceforge.net/tracker/index.php?func=detail&aid=3029746&group_id=85796&atid=577332,该文建议使用pydevd.set_pm_excepthook()。
然而,当我添加以下内容时:
看起来不起作用,GetGlobalDebugger()在全局命名空间中不存在。
经过一些搜索,我找到了这篇文章:http://sourceforge.net/tracker/index.php?func=detail&aid=3029746&group_id=85796&atid=577332,该文建议使用pydevd.set_pm_excepthook()。
然而,当我添加以下内容时:
import pydevd
pydevd.set_pm_excepthook()
当我运行我的代码时,出现了异常:
This function is now replaced by GetGlobalDebugger().setExceptHook and is now controlled by the PyDev UI.')
DeprecationWarning: This function is now replaced by GetGlobalDebugger().setExceptHook and is now controlled by the PyDev UI.
但是:
GetGlobalDebugger().setExceptHook()
看起来不起作用,GetGlobalDebugger()在全局命名空间中不存在。