traceback – Traceback Module — Adafruit CircuitPython 1 documentation (original) (raw)

This module provides a standard interface to print stack traces of programs. This is useful when you want to print stack traces under program control.

This module implements a subset of the corresponding CPython module, as described below. For more information, refer to the original CPython documentation: cpython:traceback.

Available on these boards

traceback.format_exception(exc: BaseException | Type[BaseException], /, value: BaseException | None = None, tb: types.TracebackType | None = None, limit: int | None = None, chain: bool | None = True) → List[str]

Format a stack trace and the exception information.

If the exception value is passed in exc, then this exception value and its associated traceback are used. This is compatible with CPython 3.10 and newer.

If the exception value is passed in value, then any value passed in forexc is ignored. value is used as the exception value and the traceback in the tb argument is used. In this case, if tb is None, no traceback will be shown. This is compatible with CPython 3.5 and newer.

The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly the same text is printed as does print_exception().

Parameters:

traceback.print_exception(exc: BaseException | Type[BaseException], /, value: BaseException | None = None, tb: types.TracebackType | None = None, limit: int | None = None, file: io.FileIO | None = None, chain: bool | None = True) → None

Prints exception information and stack trace entries.

If the exception value is passed in exc, then this exception value and its associated traceback are used. This is compatible with CPython 3.10 and newer.

If the exception value is passed in value, then any value passed in forexc is ignored. value is used as the exception value and the traceback in the tb argument is used. In this case, if tb is None, no traceback will be shown. This is compatible with CPython 3.5 and newer.

Parameters: