On this page
optparse.OptionError
Prev: optparse.OptionContainer | Up: optparse | Next: optparse.OptionGroup
Rel: optparse.BadOptionError, optparse.check_choice, optparse.HelpFormatter, optparse.IndentedHelpFormatter
Ref: docs.python.org โ optparse.OptionError
Tags: #public #python3 #stdlib #optparse
Import
import optparse
from optparse import OptionError
Signature & Overview
optparse.OptionError(msg, option)
Raised if an Option instance is created with invalid or inconsistent arguments.
Methods & Attributes
OptionError.add_note(self, note, /)โ Add a note to the exceptionOptionError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import optparse
assert issubclass(optparse.OptionError, optparse.OptParseError)
Gotchas
- Raised on invalid option definitions (programmer error, not CLI user input error).
REPL Inspect
from optparse import OptionError
help(OptionError)
Linked from
Related notes
- tuts/python3/stdlib_module/optparse/OptionContainer Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionGroup Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/optparse/BadOptionError Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/check_choice Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/HelpFormatter Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/IndentedHelpFormatter Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/make_option shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/Option shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionConflictError shared tags: #optparse, #stdlib