Python exceptions: is there a way to find the exception attributes?
Pierre Rouleau
pieroul at attglobal.net
Sun Dec 1 15:50:14 EST 2002
Of course, there is a simpler way to quickly get the list of attributes, as Terry Hancock suggested
in a posting below.
Just create an instance of the exception and dir() on it.
>>> import exceptions
>>> dir(IOError())
['__doc__', '__getitem__', '__init__', '__module__', '__str__', 'args', 'errno', 'filename', 'strerror']
>>> dir(UnicodeError())
['__doc__', '__getitem__', '__init__', '__module__', '__str__', 'args']
>>>
I must still be in the C and C++ way of thinking...
Thanks!
Pierre
--
Pierre Rouleau, ing.
More information about the Python-list
mailing list