On this page
  1. tomllib.TOMLDecodeError
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

tomllib.TOMLDecodeError

Prev: tomllib.loads | Up: tomllib
Rel: tomllib.load, tomllib.loads
Ref: docs.python.org โ€” tomllib.TOMLDecodeError
Tags: #public #python3 #stdlib #tomllib


Import

import tomllib
from tomllib import TOMLDecodeError

Signature & Overview

tomllib.TOMLDecodeError(msg: 'str' = <class 'tomllib._parser.DEPRECATED_DEFAULT'>, doc: 'str' = <class 'tomllib._parser.DEPRECATED_DEFAULT'>, pos: 'Pos' = <class 'tomllib._parser.DEPRECATED_DEFAULT'>, *args: 'Any')

An error raised if a document is not valid TOML.

Methods & Attributes

Usage

import tomllib

try:
    tomllib.loads("invalid = [1, 2")
except tomllib.TOMLDecodeError as exc:
    assert isinstance(exc, ValueError)

Gotchas

REPL Inspect

from tomllib import TOMLDecodeError
help(TOMLDecodeError)

Linked from

Related notes