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 <>
When I run the following program, I expect 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.
Date User Action Args
2021-02-10 10:24:37Clint Olsensetrecipients: + Clint Olsen
2021-02-10 10:24:37Clint Olsensetmessageid: <>
2021-02-10 10:24:37Clint Olsenlinkissue43192 messages
2021-02-10 10:24:37Clint Olsencreate