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 Clint Olsen
Recipients Clint Olsen
Date 2021-02-10.10:24:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612952677.32.0.0422896967903.issue43192@roundup.psfhosted.org>
In-reply-to
Content
When I run the following program, I expect args.run to be 'foo' if no argument is specified on the command-line.

parser = argparse.ArgumentParser()

parser.add_argument('foo', default='bar')

args = parser.parse_args()

$ ./test
usage: test [-h] foo
test: error: the following arguments are required: foo

However if I specify nargs='*' this error goes away.

Maybe I'm missing something obvious, but this seems non-intuitive to me.
History
Date User Action Args
2021-02-10 10:24:37Clint Olsensetrecipients: + Clint Olsen
2021-02-10 10:24:37Clint Olsensetmessageid: <1612952677.32.0.0422896967903.issue43192@roundup.psfhosted.org>
2021-02-10 10:24:37Clint Olsenlinkissue43192 messages
2021-02-10 10:24:37Clint Olsencreate