I don't know the mentioned book, but if you rewrite like: >>> import sys >>> class LinuxDriverError(Exception): ... def __init__(self, *args): ... Exception.__init__(self, *args) ... self.message = args[0] ... ... def __str__(self): ... return str(sys.exc_info()) ... >>> def test(): ... raise LinuxDriverError, "raising Cain!" ... >>> try: ... test() ... except LinuxDriverError, error: ... print error ... (<class __main__.LinuxDriverError at 0x401e305c>, <__main__.LinuxDriverError instance at 0x401deb6c>, <traceback object at 0x401df20c>) >>> # just checking ... print "sys.exc_info(): ", sys.exc_info()
This gets what you probably expect, the way you do it there is no traceback object when you print it -- http://mail.python.org/mailman/listinfo/python-list