ID EN
Sys

exception

Python 3.11

This function, when called while an exception handler is executing (such as an except or except* clause), returns the exception instance that was caught by this handler. When exception handlers are nested within one another, only the exception handled by the innermost handler is accessible.

Syntax

PYTHON
sys.exception()