Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Flask: drop into pdb on exception
def drop_into_pdb(app, exception):
import sys
import pdb
import traceback
traceback.print_exc()
pdb.post_mortem(sys.exc_info()[2])
# somewhere in your code (probably if DEBUG is True)
flask.got_request_exception.connect(drop_into_pdb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment