Built-in Exceptions

TabError — exception class

Reports inconsistent tabs and spaces in indentation where interpretation depends on tab width. Prefer consistent spaces for indentation. It is both an IndentationError and a SyntaxError. Catch TabError when this category is the recovery boundary; do not rely on the exact human-readable message.

Formal Syntax & Structure

python syntaxpython
TabError

Return Value

type

The class object TabError; this reference documents the class identity, not a universal constructor signature.

Working Example

Example Snippetpython
try:    compile("if True:\n\tpass\n        pass", "<demo>", "exec")except TabError as error:    print(type(error).__name__)
Python Reference