New submission from Ben Schmaus :
The argparse module lists required args as optional in the default help message.
If you run the following program (also attached) you'll get the output listed
below.
#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(
description = 'Do something'
)
parser.add_argument('--reqarg', '-r', help = 'This is required', required =
True)
parser.add_argument('--optarg','-o', help = "This is optional", required =
False)
args = parser.parse_args()
$ python argparse-help-says-required-args-are-optional.py -h
usage: argparse-help-says-required-args-are-optional.py [-h] --reqarg REQARG
[--optarg OPTARG]
Do something
optional arguments:
-h, --helpshow this help message and exit
--reqarg REQARG, -r REQARG
This is required
--optarg OPTARG, -o OPTARG
This is optional
$
--
components: Library (Lib)
files: argparse-help-says-required-args-are-optional.py
messages: 115017
nosy: benschmaus
priority: normal
severity: normal
status: open
title: argparse: Default Help Message Lists Required Args As Optional
type: behavior
versions: Python 2.7
Added file:
http://bugs.python.org/file18654/argparse-help-says-required-args-are-optional.py
___
Python tracker
<http://bugs.python.org/issue9694>
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com