Python exceptions: is there a way to find the exceptionattributes?

John Hunter jdhunter at ace.bsd.uchicago.edu
Sat Nov 30 20:26:17 EST 2002


>>>>> "Pierre" == Pierre Rouleau <pieroul at attglobal.net> writes:


    Pierre> I was looking for a quick way to look at exception
    Pierre> attributes from within my programming environment when i
    Pierre> have to decide what exception i should catch or which one
    Pierre> i should raise and then what information i should pass
    Pierre> inside the exception object.

Within recent interactive python shells (which include pydoc.help by
default), you can do, for example:

  help(Exception)
  help(StandardError)
  help(IOError)
  help(StandardError)
  help(AttributeError)
  help(KeyError)

With some shells (eg, ipython) you can drop the parentheses.  Is this
what you are looking for?

John Hunter




More information about the Python-list mailing list