2

When stepping through the code in pdb, any exception hit immediately ends the program. How do I instead fix the exception and keep debugging? Is there no way to avoid the overhead of restarting the program?

It seems like many py debuggers share this annoyance: pdb, ipdb, pycharm, pydev.

SwimBikeRun
  • 4,192
  • 11
  • 49
  • 85
  • You could catch the exception, run `pdb.post_mortem()` in the `except` block to poke around a bit, and then execution will continue since the exception has been handled. – wbadart Jul 31 '17 at 18:54

1 Answers1

-2

Once I find where it's crashing, I'll often set up try/except blocks to help figure out why.

try:
    # code that causes exception
except WhateverException as err:  # be specific with the type of exception  
    import pdb; pdb.set_trace()
else:
    # do what you'd normally do
af3ld
  • 782
  • 8
  • 30