Python: Print stack-trace

0 Comments

Surprisingly, this doesn't come as a standard function in the Exception class.

1.import traceback
2. try:
3.   raise Exception("print exception!")
4. except:
5.   print traceback.format_exc()

Short and simple, so good!

21e03c8c-ca74-4007-a3af-631871431c2c

Source

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog