Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Potential argparse issue?
#!/usr/bin/env python
# mac OSX 10.10.3
# python 2.7.10 (installed with homebrew)
# argparse 1.4.0
# to test - `python argparseissue.py --help`
# expected -
# usage: issue.py [-h] -f FOO [-b BAR]
#
# This is an attempt to replicate an issue with argparse
#
# required arguments:
# -f FOO, --foo FOO this argument is REQUIRED!!!
# optional arguments:
# -h, --help show this help message and exit
# -b BAR, --bar BAR this argument is optional
#
# I hope somebody fixes it!
# actual -
# usage: issue.py [-h] -f FOO [-b BAR]
#
# This is an attempt to replicate an issue with argparse
#
# optional arguments:
# -h, --help show this help message and exit
# -f FOO, --foo FOO this argument is REQUIRED!!!
# -b BAR, --bar BAR this argument is optional
#
# I hope somebody fixes it!
from argparse import ArgumentParser
parser = ArgumentParser(description='This is an attempt to replicate an issue with argparse',
epilog='I hope somebody fixes it!')
parser.add_argument('-f', '--foo', required=True, help='this argument is REQUIRED!!!')
parser.add_argument('-b', '--bar', help='this argument is optional')
parser.parse_args()
@tonygaetani

This comment has been minimized.

Copy link
Owner Author

tonygaetani commented Jan 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.