exceptions
index
(built-in)

Python's standard exception class hierarchy.
 
Before Python 1.5, the standard exceptions were all simple string objects.
In Python 1.5, the standard exceptions were converted to classes organized
into a relatively flat hierarchy.  String-based standard exceptions were
optional, or used as a fallback if some problem occurred while importing
the exception module.  With Python 1.6, optional string-based standard
exceptions were removed (along with the -X command line flag).
 
The class exceptions were implemented in such a way as to be almost
completely backward compatible.  Some tricky uses of IOError could
potentially have broken, but by Python 1.6, all of these should have
been fixed.  As of Python 1.6, the class-based standard exceptions are
now implemented in C, and are guaranteed to exist in the Python
interpreter.
 
Here is a rundown of the class hierarchy.  The classes found here are
inserted into both the exceptions module and the `built-in' module.  It is
recommended that user defined class based exceptions be derived from the
`Exception' class, although this is currently not enforced.
 
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

 
Classes
            
Exception
StandardError
ArithmeticError
FloatingPointError
OverflowError
ZeroDivisionError
AssertionError
AttributeError
EOFError
EnvironmentError
IOError
OSError
ImportError
KeyboardInterrupt
LookupError
IndexError
KeyError
MemoryError
NameError
UnboundLocalError
ReferenceError
RuntimeError
NotImplementedError
SyntaxError
IndentationError
TabError
SystemError
TypeError
ValueError
UnicodeError
StopIteration
SystemExit
Warning
DeprecationWarning
OverflowWarning
RuntimeWarning
SyntaxWarning
UserWarning
 
class ArithmeticError(StandardError)
      Base class for arithmetic errors.
 
  
Method resolution order:
ArithmeticError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Base class for arithmetic errors.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class AssertionError(StandardError)
      Assertion failed.
 
  
Method resolution order:
AssertionError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Assertion failed.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class AttributeError(StandardError)
      Attribute not found.
 
  
Method resolution order:
AttributeError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Attribute not found.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class DeprecationWarning(Warning)
      Base class for warnings about deprecated features.
 
  
Method resolution order:
DeprecationWarning
Warning
Exception

Data and non-method functions defined here:
__doc__ = 'Base class for warnings about deprecated features.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class EOFError(StandardError)
      Read beyond end of file.
 
  
Method resolution order:
EOFError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Read beyond end of file.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class EnvironmentError(StandardError)
      Base class for I/O related errors.
 
  
Method resolution order:
EnvironmentError
StandardError
Exception

Methods defined here:
__init__(...)
__str__(...)

Data and non-method functions defined here:
__doc__ = 'Base class for I/O related errors.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
 
class Exception
      Common base class for all exceptions.
 
   Methods defined here:
__getitem__(...)
__init__(...)
__str__(...)

Data and non-method functions defined here:
__doc__ = 'Common base class for all exceptions.'
__module__ = 'exceptions'
 
class FloatingPointError(ArithmeticError)
      Floating point operation failed.
 
  
Method resolution order:
FloatingPointError
ArithmeticError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Floating point operation failed.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class IOError(EnvironmentError)
      I/O operation failed.
 
  
Method resolution order:
IOError
EnvironmentError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'I/O operation failed.'
__module__ = 'exceptions'

Methods inherited from EnvironmentError:
__init__(...)
__str__(...)

Methods inherited from Exception:
__getitem__(...)
 
class ImportError(StandardError)
      Import can't find module, or can't find name in module.
 
  
Method resolution order:
ImportError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = "Import can't find module, or can't find name in module."
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class IndentationError(SyntaxError)
      Improper indentation.
 
  
Method resolution order:
IndentationError
SyntaxError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Improper indentation.'
__module__ = 'exceptions'

Methods inherited from SyntaxError:
__init__(...)
__str__(...)

Data and non-method functions inherited from SyntaxError:
filename = None
lineno = None
msg = ''
offset = None
text = None

Methods inherited from Exception:
__getitem__(...)
 
class IndexError(LookupError)
      Sequence index out of range.
 
  
Method resolution order:
IndexError
LookupError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Sequence index out of range.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class KeyError(LookupError)
      Mapping key not found.
 
  
Method resolution order:
KeyError
LookupError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Mapping key not found.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class KeyboardInterrupt(StandardError)
      Program interrupted by user.
 
  
Method resolution order:
KeyboardInterrupt
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Program interrupted by user.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class LookupError(StandardError)
      Base class for lookup errors.
 
  
Method resolution order:
LookupError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Base class for lookup errors.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class MemoryError(StandardError)
      Out of memory.
 
  
Method resolution order:
MemoryError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Out of memory.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class NameError(StandardError)
      Name not found globally.
 
  
Method resolution order:
NameError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Name not found globally.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class NotImplementedError(RuntimeError)
      Method or function hasn't been implemented yet.
 
  
Method resolution order:
NotImplementedError
RuntimeError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = "Method or function hasn't been implemented yet."
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class OSError(EnvironmentError)
      OS system call failed.
 
  
Method resolution order:
OSError
EnvironmentError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'OS system call failed.'
__module__ = 'exceptions'

Methods inherited from EnvironmentError:
__init__(...)
__str__(...)

Methods inherited from Exception:
__getitem__(...)
 
class OverflowError(ArithmeticError)
      Result too large to be represented.
 
  
Method resolution order:
OverflowError
ArithmeticError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Result too large to be represented.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class OverflowWarning(Warning)
      Base class for warnings about numeric overflow.
 
  
Method resolution order:
OverflowWarning
Warning
Exception

Data and non-method functions defined here:
__doc__ = 'Base class for warnings about numeric overflow.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class ReferenceError(StandardError)
      Weak ref proxy used after referent went away.
 
  
Method resolution order:
ReferenceError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Weak ref proxy used after referent went away.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class RuntimeError(StandardError)
      Unspecified run-time error.
 
  
Method resolution order:
RuntimeError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Unspecified run-time error.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class RuntimeWarning(Warning)
      Base class for warnings about dubious runtime behavior.
 
  
Method resolution order:
RuntimeWarning
Warning
Exception

Data and non-method functions defined here:
__doc__ = 'Base class for warnings about dubious runtime behavior.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class StandardError(Exception)
      Base class for all standard Python exceptions.
 
   Data and non-method functions defined here:
__doc__ = 'Base class for all standard Python exceptions.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class StopIteration(Exception)
      Signal the end from iterator.next().
 
   Data and non-method functions defined here:
__doc__ = 'Signal the end from iterator.next().'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class SyntaxError(StandardError)
      Invalid syntax.
 
  
Method resolution order:
SyntaxError
StandardError
Exception

Methods defined here:
__init__(...)
__str__(...)

Data and non-method functions defined here:
__doc__ = 'Invalid syntax.'
__module__ = 'exceptions'
filename = None
lineno = None
msg = ''
offset = None
text = None

Methods inherited from Exception:
__getitem__(...)
 
class SyntaxWarning(Warning)
      Base class for warnings about dubious syntax.
 
  
Method resolution order:
SyntaxWarning
Warning
Exception

Data and non-method functions defined here:
__doc__ = 'Base class for warnings about dubious syntax.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class SystemError(StandardError)
      Internal error in the Python interpreter.
 
Please report this to the Python maintainer, along with the traceback,
the Python version, and the hardware/OS platform and version.
 
  
Method resolution order:
SystemError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Internal error in the Python interpreter.\n\nPl...rsion, and the hardware/OS platform and version.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class SystemExit(Exception)
      Request to exit from the interpreter.
 
   Methods defined here:
__init__(...)

Data and non-method functions defined here:
__doc__ = 'Request to exit from the interpreter.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__str__(...)
 
class TabError(IndentationError)
      Improper mixture of spaces and tabs.
 
  
Method resolution order:
TabError
IndentationError
SyntaxError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Improper mixture of spaces and tabs.'
__module__ = 'exceptions'

Methods inherited from SyntaxError:
__init__(...)
__str__(...)

Data and non-method functions inherited from SyntaxError:
filename = None
lineno = None
msg = ''
offset = None
text = None

Methods inherited from Exception:
__getitem__(...)
 
class TypeError(StandardError)
      Inappropriate argument type.
 
  
Method resolution order:
TypeError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Inappropriate argument type.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class UnboundLocalError(NameError)
      Local name referenced but not bound to a value.
 
  
Method resolution order:
UnboundLocalError
NameError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Local name referenced but not bound to a value.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class UnicodeError(ValueError)
      Unicode related error.
 
  
Method resolution order:
UnicodeError
ValueError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Unicode related error.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class UserWarning(Warning)
      Base class for warnings generated by user code.
 
  
Method resolution order:
UserWarning
Warning
Exception

Data and non-method functions defined here:
__doc__ = 'Base class for warnings generated by user code.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class ValueError(StandardError)
      Inappropriate argument value (of correct type).
 
  
Method resolution order:
ValueError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Inappropriate argument value (of correct type).'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class Warning(Exception)
      Base class for warning categories.
 
   Data and non-method functions defined here:
__doc__ = 'Base class for warning categories.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class ZeroDivisionError(ArithmeticError)
      Second argument to a division or modulo operation was zero.
 
  
Method resolution order:
ZeroDivisionError
ArithmeticError
StandardError
Exception

Data and non-method functions defined here:
__doc__ = 'Second argument to a division or modulo operation was zero.'
__module__ = 'exceptions'

Methods inherited from Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
Data
             __name__ = 'exceptions'