eclipse 在 pydev 中中断异常

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/455552/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:28:50  来源:igfitidea点击:

Break on exception in pydev

pythoneclipsedebuggingexceptionpydev

提问by Mat

Is it possible to get the pydev debugger to break on exception?

是否有可能让 pydev 调试器在异常时中断?

采纳答案by Yuval Adam

On anyexception?

什么例外吗?

If my memory serves me right, in PyDev (in Eclipse) this is possible.

如果我没记错的话,在 PyDev(在 Eclipse 中)这是可能的。



EDIT:编辑:再次通过它,检查pdb documentationpdb 文档,找不到设置异常断点的方法。

If I may suggest a really crude workaround, but if you must, you can call your program from within a try-exceptblock, set a breakpoint there, and once it breaks in the exceptblock just go up the stack and debug your error.

如果我可以建议一个非常粗略的解决方法,但如果你必须,你可以从一个try-except块中调用你的程序,在那里设置一个断点,一旦它在except块中中断,就向上堆栈并调试你的错误。

Another editThis functionality has been added to PyDev

另一个编辑此功能已添加到 PyDev

回答by eacousineau

This was added by the PyDev author, under Run > Manage Python Exception Breakpoints

这是由 PyDev 作者在 Run > Manage Python Exception Breakpoints 下添加的

回答by JimmyZ

I've tried the big try-except trick but it didn't work as expected, you got the stack where it breaks, that is in the except: block, you can't get to the stack where the exception was raised from there, that's pointless.

我已经尝试了大的 try-except 技巧,但它没有按预期工作,你得到了它中断的堆栈,即在 except: 块中,你无法到达从那里引发异常的堆栈,那毫无意义。

update: pydev does have break-on-exception facility since 1.6.0, but no UI yet, need some code: https://sourceforge.net/tracker/?func=detail&aid=2970886&group_id=85796&atid=577332

更新:自 1.6.0 以来,pydev 确实具有中断异常功能,但还没有 UI,需要一些代码:https://sourceforge.net/tracker/?func=detail&aid=2970886&group_id=85796&atid=577332

回答by John Salvatier

Long since over, but feature requests go on sourceforge.

早就结束了,但功能请求仍在 sourceforge 上