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 either class objects or string objects, depending on the use of the -X option to the interpreter. For completeness, here are all the variables: PyExc_Exception, PyExc_StandardError, PyExc_ArithmeticError, PyExc_LookupError, PyExc_AssertionError, PyExc_AttributeError, PyExc_EOFError, PyExc_FloatingPointError, PyExc_IOError, PyExc_ImportError, PyExc_IndexError, PyExc_KeyError, PyExc_KeyboardInterrupt, PyExc_MemoryError, PyExc_NameError, PyExc_OverflowError, PyExc_RuntimeError, PyExc_SyntaxError, PyExc_SystemError, PyExc_SystemExit, PyExc_TypeError, PyExc_ValueError, PyExc_ZeroDivisionError.