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 |
---|---|---|
PyExc_Exception | Exception | (1) |
PyExc_StandardError | StandardError | (1) |
PyExc_ArithmeticError | ArithmeticError | (1) |
PyExc_LookupError | LookupError | (1) |
PyExc_AssertionError | AssertionError | |
PyExc_AttributeError | AttributeError | |
PyExc_EOFError | EOFError | |
PyExc_EnvironmentError | EnvironmentError | (1) |
PyExc_FloatingPointError | FloatingPointError | |
PyExc_IOError | IOError | |
PyExc_ImportError | ImportError | |
PyExc_IndexError | IndexError | |
PyExc_KeyError | KeyError | |
PyExc_KeyboardInterrupt | KeyboardInterrupt | |
PyExc_MemoryError | MemoryError | |
PyExc_NameError | NameError | |
PyExc_NotImplementedError | NotImplementedError | |
PyExc_OSError | OSError | |
PyExc_OverflowError | OverflowError | |
PyExc_ReferenceError | ReferenceError | (2) |
PyExc_RuntimeError | RuntimeError | |
PyExc_SyntaxError | SyntaxError | |
PyExc_SystemError | SystemError | |
PyExc_SystemExit | SystemExit | |
PyExc_TypeError | TypeError | |
PyExc_ValueError | ValueError | |
PyExc_WindowsError | WindowsError | (3) |
PyExc_ZeroDivisionError | ZeroDivisionError |
Notes:
MS_WINDOWS
is defined.
See About this document... for information on suggesting changes.