On this page
configparser.InterpolationSyntaxError
Prev: configparser.InterpolationMissingOptionError | Up: configparser | Next: configparser.InvalidWriteError
Rel: configparser.BasicInterpolation, configparser.ConfigParser, configparser.ConverterMapping, configparser.DuplicateOptionError
Ref: docs.python.org โ configparser.InterpolationSyntaxError
Tags: #public #python3 #stdlib #configparser
Import
import configparser
from configparser import InterpolationSyntaxError
Signature & Overview
configparser.InterpolationSyntaxError(option, section, msg)
Raised when the source text contains invalid syntax.
Methods & Attributes
InterpolationSyntaxError.add_note(self, note, /)โ Add a note to the exceptionInterpolationSyntaxError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import configparser
cp = configparser.ConfigParser()
cp.read_string("[s]\nrate = 100%\n")
try:
_ = cp["s"]["rate"]
except configparser.InterpolationSyntaxError:
assert True
Gotchas
- Classic
%trap: Escape%as%%in INI files, or passinterpolation=None.
REPL Inspect
from configparser import InterpolationSyntaxError
help(InterpolationSyntaxError)
Linked from
Related notes
- tuts/python3/stdlib_module/configparser/InterpolationMissingOptionError Linked here; links to this page; shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser/InvalidWriteError Linked here; links to this page; shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser/BasicInterpolation Linked here; shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser/ConfigParser Linked here; shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser/ConverterMapping Linked here; shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser/DuplicateOptionError Linked here; shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/configparser/DuplicateSectionError shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser/ExtendedInterpolation shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser/Interpolation shared tags: #configparser, #stdlib