This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author benschmaus
Recipients benschmaus
Date 2010-08-26.18:19:16
SpamBayes Score 4.3495685e-08
Marked as misclassified No
Message-id <1282846759.11.0.900867962743.issue9694@psf.upfronthosting.co.za>
In-reply-to
Content
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, --help            show this help message and exit
  --reqarg REQARG, -r REQARG
                        This is required
  --optarg OPTARG, -o OPTARG
                        This is optional
$
History
Date User Action Args
2010-08-26 18:19:19benschmaussetrecipients: + benschmaus
2010-08-26 18:19:19benschmaussetmessageid: <1282846759.11.0.900867962743.issue9694@psf.upfronthosting.co.za>
2010-08-26 18:19:17benschmauslinkissue9694 messages
2010-08-26 18:19:17benschmauscreate