Catching and printing python exceptions

>>> import traceback, sys
>>> try:
...     1/0
... except:
...     traceback.print_exc(sys.exc_info())
...
Traceback (most recent call last):
  File "<stdin>", line 2, in ?
ZeroDivisionError: integer division or modulo by zero
>>>

Comments