What Exceptions are there? (was: "a better input")
Duncan Booth
duncan at NOSPAMrcp.co.uk
Fri May 10 11:15:02 EDT 2002
"Emile van Sebille" <emile at fenx.com> wrote in
news:hQQC8.10635$Po6.194 at rwcrnsc52.ops.asp.att.net:
> Louis M. Pecora
>> Ok, you knew there was an exception of that type (ValueError), but is
>> there a way to get a list of exceptions in a Python module or in the
>> main Python core? There are probably zillions.
>
> dir(__builtins__) gives you a good start.
>
If you have a sufficiently recent version of Python:
Go to your python installation, change into the lib directory and run:
pydoc -g
You should get a small window popping up with some buttons and a text box
labelled 'Search for'. Type 'exceptions' into the box, press return and
click on the second entry 'exceptions - Python's standard exception class
hierarchy'.
This should open your browser with an HTML page describing exceptions and
giving (amongst other things) a class hierarchy:
Exception
|
+-- SystemExit
+-- StopIteration
+-- StandardError
| |
| +-- KeyboardInterrupt
| +-- ImportError
| +-- EnvironmentError
| | |
| | +-- IOError
| | +-- OSError
| | |
| | +-- WindowsError
| |
| +-- EOFError
| +-- RuntimeError
| | |
| | +-- NotImplementedError
| |
| +-- NameError
| | |
| | +-- UnboundLocalError
| |
| +-- AttributeError
| +-- SyntaxError
| | |
| | +-- IndentationError
| | |
| | +-- TabError
| |
| +-- TypeError
| +-- AssertionError
| +-- LookupError
| | |
| | +-- IndexError
| | +-- KeyError
| |
| +-- ArithmeticError
| | |
| | +-- OverflowError
| | +-- ZeroDivisionError
| | +-- FloatingPointError
| |
| +-- ValueError
| | |
| | +-- UnicodeError
| |
| +-- ReferenceError
| +-- SystemError
| +-- MemoryError
|
+---Warning
|
+-- UserWarning
+-- DeprecationWarning
+-- SyntaxWarning
+-- OverflowWarning
+-- RuntimeWarning
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list