47
votes

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

4
There is a slight peculiarity in the Run->Pydev Manage Python Exception Breakpoints UI, which is that the option appears in both the Python perspective and Debug perspective Run menus but is normally (always?) disabled in the Python one. I don't know why this is, but in any case the option should always be enabled in the Debug perspective. - John Armstrong

4 Answers

17
votes

On any exception?

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


EDIT:pdb documentation

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

52
votes

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

4
votes

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

2
votes

Long since over, but feature requests go on sourceforge.