Debug Python applications with styles!
Print more details in python stack trace
Credit to a stackoverflow post here
import sys
import traceback
import cgitb
def handleException(excType, excValue, trace):
print 'error'
cgitb.Hook(format="text")(excType, excValue, trace)
sys.excepthook = handleException
#example code
h = 1
k = 0
print h/k
Debug python program
One way is to run your program with
pdb <program.py>
Another way is to break the execution flow only at the place you want using
...
import pdb; pdb.set_trace()
...