try: ..Call the thing you wish to debug.. except: import sys, pdb t, v, tb = sys.exc_info() pdb.post_mortem(tb)