Python Forum
How to recover from exception in pdb? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to recover from exception in pdb? (/thread-4193.html)



How to recover from exception in pdb? - swimbikerun - Jul-29-2017

When stepping through the code in pdb and a line is ran that triggers an error, is there a way to fix the error without exiting the execution of the script?

I know it's possible to type !command and test the execution of commands prior to typing n for next in the debugger. However, if I do cross a command that throws an exception, is there a way to j jump back (doesn't seem to work) or otherwise avoid restarting the program.

The overhead of restarting the program is the whole reason I use a debugger instead of exclusively print statements in the first place.

Thanks! :D


RE: How to recover from exception in pdb? - Larz60+ - Jul-29-2017

Not sure, but perhaps:
pdb.post_mortem([i]traceback=None[/i])