89DEVs

Python Built-in Exceptions

Built-in Exceptions

Python has built-in exception that can give some insights into why the exception occurred. On this page an overview of the different exception is given. For more details see the specific exception page.
exception description
ArithmeticError raised when an error occurs during numeric calculations
AssertionError raised when an error occurs within an assert statement
AttributeError raised when an error occurs during an attribute reference or assignment
EOFError raised when an end of file Error occurs
FloatingPointError raised when an error occurs during a floating point calculation
GeneratorExit raised when a generator is closed with the close() method
ImportError raised when an error occurs during the import of a module
IndentationError raised when an error occurs, because of incorrect indentation
IndexError raised when an error occurs, because an index does not exist
KeyError raised when an error occurs, because an key does not exist
LookupError raised when an error occurs and the error can't be found
MemoryError raised when an error occurs, because the program ran out of memory
NameError raised when an error occurs, because the variable does not exist
NotImplementedError raised when an error occurs, because the abstract method requires an inherited class
OSError raised when an system related error occurs
OverflowError raised when an error occurs, because the result of a numeric calculation is too large
ReferenceError raised when an error occurs, because the reference object does not exists
RuntimeError raised when an error occurs and no other exception is raised
StopIteration raised when an error occurs, because the next() method of an iterator has no next value
SyntaxError raised when an error occurs, because of wrong syntax
SystemError raised when an system error occurs
SystemExit raised when the sys.exit() method is called
TabError raised when an error occurs, because the indentation consists of tabs
TypeError raised when an object of inappropriate type is applied to a function or operation.
UnboundLocalError raised when an error occurs, because a local variable is referenced before it is assigned
UnicodeError raised when an error occurs, because of a problem with unicode
UnicodeEncodeError raised when an error occurs, because of a problem with unicode encoding
UnicodeDecodeError raised when an error occurs, because of a problem with unicode decoding
UnicodeTranslateError raised when an error occurs, because of a problem with unicode translation
ValueError raised when an error occurs, because of a problem with the data type
ZeroDivisionError raised when an error occurs, because a value is divided by 0

                
        

Summary


Click to jump to section