Add PDB on exception debug tool and config setting

This commit is contained in:
Roberto Rosario
2012-07-29 01:14:32 -04:00
parent d1e59b1d7b
commit 6fa0c226b0
2 changed files with 20 additions and 0 deletions

16
apps/common/debug.py Normal file
View File

@@ -0,0 +1,16 @@
import sys, pdb
previous_except_hook = None
def except_hook(exctype, value, traceback):
if previous_except_hook:
previous_except_hook(exctype, value, traceback)
pdb.post_mortem(traceback)
def insert_pdb_exception_hook():
previous_except_hook = sys.excepthook
sys.excepthook = except_hook