Message386770
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. |
|
Date |
User |
Action |
Args |
2021-02-10 10:24:37 | Clint Olsen | set | recipients:
+ Clint Olsen |
2021-02-10 10:24:37 | Clint Olsen | set | messageid: <1612952677.32.0.0422896967903.issue43192@roundup.psfhosted.org> |
2021-02-10 10:24:37 | Clint Olsen | link | issue43192 messages |
2021-02-10 10:24:37 | Clint Olsen | create | |
|