[issue22047] argparse improperly prints mutually exclusive options when they are in a group
Sam Kerr
report at bugs.python.org
Wed Jul 23 18:03:44 CEST 2014
New submission from Sam Kerr:
The following code:
import argparse
parser = argparse.ArgumentParser()
group1 = parser.add_mutually_exclusive_group()
group2 = group1.add_mutually_exclusive_group()
group2.add_argument('-hello',action='store_true', help="A flag")
args = parser.parse_args()
produces this output:
skerr at gravel:~$ python bug.py -h
usage: bug.py [-h] [[-hello]
optional arguments:
-h, --help show this help message and exit
-hello A flag
skerr at gravel:~$
Note the double [[ around hello, but there is no double ]] to close it. This is the error.
----------
components: Library (Lib)
messages: 223744
nosy: Sam.Kerr
priority: normal
severity: normal
status: open
title: argparse improperly prints mutually exclusive options when they are in a group
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22047>
_______________________________________
More information about the Python-bugs-list
mailing list