On this page
configparser.NoSectionError
Prev: configparser.NoOptionError | Up: configparser | Next: configparser.ParsingError
Rel: configparser.BasicInterpolation, configparser.ConfigParser, configparser.ConverterMapping, configparser.DuplicateOptionError
Ref: docs.python.org โ configparser.NoSectionError
Tags: #public #python3 #stdlib #configparser
Import
import configparser
from configparser import NoSectionError
Signature & Overview
configparser.NoSectionError(section)
Raised when no section matches a requested option.
Methods & Attributes
NoSectionError.add_note(self, note, /)โ Add a note to the exceptionNoSectionError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import configparser
cp = configparser.ConfigParser()
try:
cp.get("missing", "k")
except configparser.NoSectionError:
assert True
Gotchas
- Also avoided with
fallback=:cp.get("missing", "k", fallback=None)returnsNonecleanly.
REPL Inspect
from configparser import NoSectionError
help(NoSectionError)
Linked from
Related notes
- tuts/python3/stdlib_module/configparser/NoOptionError Linked here; links to this page; shared tags: #configparser, #stdlib
- tuts/python3/stdlib_module/configparser/ParsingError 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