On this page
optparse.BadOptionError
Up: optparse | Next: optparse.check_choice
Rel: optparse.check_choice, optparse.HelpFormatter, optparse.IndentedHelpFormatter, optparse.make_option
Ref: docs.python.org โ optparse.BadOptionError
Tags: #public #python3 #stdlib #optparse
Import
import optparse
from optparse import BadOptionError
Signature & Overview
optparse.BadOptionError(opt_str)
Raised if an invalid option is seen on the command line.
Methods & Attributes
BadOptionError.add_note(self, note, /)โ Add a note to the exceptionBadOptionError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import optparse
assert issubclass(optparse.BadOptionError, optparse.OptParseError)
Gotchas
- Deprecated module: Prefer argparse in new code.
REPL Inspect
from optparse import BadOptionError
help(BadOptionError)
Linked from
- tuts/python3/stdlib_module/optparse
- tuts/python3/stdlib_module/optparse/check_choice
- tuts/python3/stdlib_module/optparse/HelpFormatter
- tuts/python3/stdlib_module/optparse/IndentedHelpFormatter
- tuts/python3/stdlib_module/optparse/make_option
- tuts/python3/stdlib_module/optparse/Option
- tuts/python3/stdlib_module/optparse/OptionConflictError
- tuts/python3/stdlib_module/optparse/OptionContainer
- tuts/python3/stdlib_module/optparse/OptionError
- tuts/python3/stdlib_module/optparse/OptionGroup
- tuts/python3/stdlib_module/optparse/OptionParser
- tuts/python3/stdlib_module/optparse/OptionValueError
- tuts/python3/stdlib_module/optparse/OptParseError
- tuts/python3/stdlib_module/optparse/TitledHelpFormatter
- tuts/python3/stdlib_module/optparse/Values
Related notes
- tuts/python3/stdlib_module/optparse/check_choice Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/HelpFormatter Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/IndentedHelpFormatter Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/make_option 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/Option links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionConflictError links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionContainer links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionError links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionGroup links to this page; shared tags: #optparse, #stdlib