foo.py
import traceback try: raise Exception() except: print traceback.format_exc()
Recommended Posts