Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Python : Redirect Exceptions Hook

DZone's Guide to

Python : Redirect Exceptions Hook

·
Free Resource

import sys, traceback, string

def myExceptHook(type, value, tb):
   sys.__excepthook__(type, value, tb)
   lines = traceback.format_exception(type, value, tb)
   print string.join(lines)

sys.excepthook = myExceptHook
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}