On this page
getopt.GetoptError
Prev: getopt.getopt | Up: getopt | Next: getopt.gnu_getopt
Rel: getopt.error, getopt.getopt, getopt.gnu_getopt
Ref: docs.python.org โ getopt.GetoptError
Tags: #public #python3 #stdlib #getopt
Import
import getopt
from getopt import GetoptError
Signature & Overview
getopt.GetoptError(msg, opt='')
getopt.GetoptError class.
Methods & Attributes
GetoptError.add_note(self, note, /)โ Add a note to the exceptionGetoptError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import getopt
try:
getopt.getopt(["-z"], "ab:")
except getopt.GetoptError as exc:
assert exc.opt == "z"
Gotchas
- Exposes
.msgand.opt: Raised on unknown flags or missing option arguments.
REPL Inspect
from getopt import GetoptError
help(GetoptError)
Linked from
Related notes
- tuts/python3/stdlib_module/getopt/error Linked here; links to this page; shared tags: #getopt, #stdlib
- tuts/python3/stdlib_module/getopt/getopt Linked here; links to this page; shared tags: #getopt, #stdlib
- tuts/python3/stdlib_module/getopt/gnu_getopt Linked here; links to this page; shared tags: #getopt, #stdlib
- tuts/python3/stdlib_module/getopt links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib