def debug_on_error(type, value, tb):
 traceback.print_exc(type, value, tb)
 print
 pdb.pm()

def debug_on_error ( type , value , tb ) : traceback . print_exc ( type , value , tb ) print pdb . pm ( )
code due to thomas heller - published in python cookbook .