Post-Mortem Debugging arranged within a Python Script (pydb.exception_hook)

If you didn't start your program inside a Python interpreter shell, there you can still get into the debugger when an exception occurs. Here you need to arrange for this possibility adding to the script these lines:

  import pydb, sys
  sys.excepthook = pydb.exception_hook

See About this document... for information on suggesting changes.