pydev 中的异常中断

发布于 2024-07-12 05:31:46 字数 29 浏览 5 评论 0原文

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

各自安好 2024-07-19 05:31:46

这是由 PyDev 作者在 Run > 下添加的 管理 Python 异常断点

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

故事和酒 2024-07-19 05:31:46

任何异常吗?

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


EDIT: went through it again, checked pdb documentation, can't find a way to set an exception breakpoint.

如果我可以建议一个非常粗略的解决方法,但如果必须的话,您可以从 try- except 块中调用您的程序,在那里设置一个断点,一旦它在 except< /code> 块只是进入堆栈并调试您的错误。

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

On any exception?

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


EDIT: went through it again, checked pdb documentation, can't find a way to set an exception breakpoint.

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

Another edit This functionality has been added to PyDev

递刀给你 2024-07-19 05:31:46

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

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

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.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文