ID EN
Built-in Exceptions

BaseException

Python 3.11

The base class for all built-in exceptions. It is not meant to be directly inherited by user-defined classes (for that, use Exception). If str() is called on an instance of this class, the representation of the argument(s) to the instance are returned, or the empty string when there were no arguments.

Syntax

PYTHON
exception BaseException

Examples

Example 1
PYTHON
try:
    ...
except SomeException:
    tb = sys.exception().__traceback__
    raise OtherException(...).with_traceback(tb)

See Also

Exception str() OSError traceback object The raise statement TypeError add_note() add_note()