All standard Python exceptions are available as global variables whose names are "PyExc_" followed by the Python exception name. These have the type PyObject*; they are all class objects. For completeness, here are all the variables:
C Name | Python Name | Notes |
---|---|---|
Exception | (1) | |
StandardError | (1) | |
ArithmeticError | (1) | |
LookupError | (1) | |
AssertionError | ||
AttributeError | ||
EOFError | ||
EnvironmentError | (1) | |
FloatingPointError | ||
IOError | ||
ImportError | ||
IndexError | ||
KeyError | ||
KeyboardInterrupt | ||
MemoryError | ||
NameError | ||
NotImplementedError | ||
OSError | ||
OverflowError | ||
RuntimeError | ||
SyntaxError | ||
SystemError | ||
SystemExit | ||
TypeError | ||
ValueError | ||
WindowsError | (2) | |
ZeroDivisionError |
Notes:
MS_WINDOWS
is defined.
See About this document... for information on suggesting changes.