[New-bugs-announce] [issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False
Matthew Hughes
report at bugs.python.org
Thu Jul 9 04:40:33 EDT 2020
New submission from Matthew Hughes <matthewhughes934 at gmail.com>:
>>> import argparse
>>> parser = argparse.ArgumentParser(exit_on_error=False)
>>> parser.parse_args(["--unknown"])
usage: [-h]
: error: unrecognized arguments: --unknown
The docs https://docs.python.org/3.10/library/argparse.html#exit-on-error say:
> Normally, when you pass an invalid argument list to the parse_args() method of an ArgumentParser, it will exit with error info.
> If the user would like catch errors manually, the feature can be enable by setting exit_on_error to False:
This description _appears_ to be at odds with the observed behavior.
----------
components: Library (Lib)
messages: 373382
nosy: mhughes
priority: normal
severity: normal
status: open
title: Argparse.parse_args exits on unrecognized option with exit_on_error=False
type: behavior
versions: Python 3.10
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41255>
_______________________________________
More information about the New-bugs-announce
mailing list