Skip to content

Instantly share code, notes, and snippets.

@kentavv
Last active March 19, 2019 13:51
Show Gist options
  • Save kentavv/a3915b40bd8759d6c1465679010e8a2d to your computer and use it in GitHub Desktop.
Save kentavv/a3915b40bd8759d6c1465679010e8a2d to your computer and use it in GitHub Desktop.
Invoking python debugger on exception
import pdb
try:
1/0
except Exception:
# Just say "no" to endless debug-prints
pdb.post_mortem()
#<stdin>(2)<module>()
#(Pdb) h
#
#Documented commands (type help <topic>):
#========================================
#EOF c d h list q rv undisplay
#a cl debug help ll quit s unt
#alias clear disable ignore longlist r source until
#args commands display interact n restart step up
#b condition down j next return tbreak w
#break cont enable jump p retval u whatis
#bt continue exit l pp run unalias where
#
#Miscellaneous help topics:
#==========================
#exec pdb
#
#(Pdb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment