[Tutor] traceback

spir denis.spir at free.fr
Tue Jan 13 13:50:49 CET 2009


is there a way to read an exception's traceback? Cannot find it in object attributes. [dir()
shows no traceback, __dict__ is empty.]

t = "a"
	print t[1]
except IndexError, e:
	print e
	print repr(e)
	print dir(e)
	print e. __dict__
	print e.args
	print e.message


string index out of range
IndexError('string index out of range',)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__getitem__', '__getslice__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__str__', 'args', 'message']
('string index out of range',)
string index out of range
Traceback (most recent call last):
  File "___test__.py", line 10, in <module>
    print t[1]
IndexError: string index out of range


la vida e estranya

More information about the Tutor mailing list