Built-in Exceptions

Built-in exceptions are contained in the exceptions module, which is always loaded prior to the execution of any program. Exceptions are defined as classes. The following exceptions serve as base classes for all the other exceptions:

Exception

The root class for all exceptions. All built-in exceptions are derived from this class. User-defined exceptions should use this as a base class.

StandardError

The base class for all built-in exceptions except for SystemExit and StopIteration.

ArithmeticError

The base class for arithmetic exceptions, including OverflowError, ZeroDivisionError, and FloatingPointError.

LookupError

The base class for indexing and key errors, including IndexError and KeyError.

EnvironmentError

The base class ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.