On this page
configparser.InterpolationMissingOptionError
Prev: configparser.InterpolationError | Up: configparser | Next: configparser.InterpolationSyntaxError
Rel: configparser.BasicInterpolation, configparser.ConfigParser, configparser.ConverterMapping, configparser.DuplicateOptionError
Ref: docs.python.org โ configparser.InterpolationMissingOptionError
Tags: #public #python3 #stdlib #configparser
Import
import configparser
from configparser import InterpolationMissingOptionError
Signature & Overview
configparser.InterpolationMissingOptionError(option, section, rawval, reference)
A string substitution required a setting which was not available.
Methods & Attributes
InterpolationMissingOptionError.add_note(self, note, /)โ Add a note to the exceptionInterpolationMissingOptionError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import configparser
cp = configparser.ConfigParser()
cp.read_string("[s]\npath = %(missing)s/file\n")
try:
_ = cp["s"]["path"]
except configparser.InterpolationMissingOptionError:
assert True
Gotchas
- Raised lazily on access, not during
read_string(): Passraw=Truetocp.get("s", "path", raw=True)to skip interpolation.
REPL Inspect
from configparser import InterpolationMissingOptionError
help(InterpolationMissingOptionError)
Linked from
Related notes
- tuts/python3/stdlib_module/configparser/InterpolationError Linked here; links to this page; shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser/InterpolationSyntaxError 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