On this page
configparser.ParsingError
Prev: configparser.NoSectionError | Up: configparser | Next: configparser.RawConfigParser
Rel: configparser.BasicInterpolation, configparser.ConfigParser, configparser.ConverterMapping, configparser.DuplicateOptionError
Ref: docs.python.org — configparser.ParsingError
Tags: #public #python3 #stdlib #configparser
Import
import configparser
from configparser import ParsingError
Signature & Overview
configparser.ParsingError(source, *args)
Raised when a configuration file does not follow legal syntax.
Methods & Attributes
ParsingError.add_note(self, note, /)— Add a note to the exceptionParsingError.append(self, lineno, line)—ParsingError.appendmethod/property.ParsingError.combine(self, others)—ParsingError.combinemethod/property.ParsingError.with_traceback(self, tb, /)— Set self.traceback to tb and return self.
Usage
import configparser
cp = configparser.ConfigParser()
try:
cp.read_string("[s]\nnot_a_key_value_line\n")
except configparser.ParsingError:
assert True
Gotchas
- Allow valueless keys with
allow_no_value=Trueif your INI file has bare flag lines.
REPL Inspect
from configparser import ParsingError
help(ParsingError)
Linked from
Related notes
- tuts/python3/stdlib_module/configparser/NoSectionError Linked here; links to this page; shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser/RawConfigParser 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