import sysimport tracebackdef excFunc() : raise ValueError try: excFunc()except: print "Got an exception" print traceback.print_stack(sys.exc_info()[2])