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@gravel:~$ python bug.py -h
usage: bug.py [-h] [[-hello]
optional arguments:
-h, --help show this help message and exit
-hello A flag
skerr@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 <[email protected]>
<http://bugs.python.org/issue22047>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com