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.
Created on 2012年07月23日 09:48 by slikts, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (1) | |||
|---|---|---|---|
| msg166217 - (view) | Author: Reinis Ivanovs (slikts) | Date: 2012年07月23日 09:48 | |
I set a positional argument and an optional argument that accepts a list:
> parser = argparse.ArgumentParser()
> parser.add_argument('foo')
> parser.add_argument('-bar', nargs='*')
The usage line I get from --help is this:
> $ example.py --help
> usage: example.py [-h] [-bar [BAR [BAR ...]]] foo
Trying to actually follow the usage instructions produces this error:
> $ example.py -bar x y z
> error: too few arguments
Reversing the argument order works however:
> $ example.py z -bar x y
So the usage instructions are clearly wrong.
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:33 | admin | set | github: 59638 |
| 2012年07月23日 16:46:08 | bethard | set | status: open -> closed |
| 2012年07月23日 16:46:01 | bethard | set | superseder: argparse optionals with nargs='?', '*' or '+' can't be followed by positionals resolution: duplicate |
| 2012年07月23日 15:27:14 | chris.jerdonek | set | nosy:
+ chris.jerdonek |
| 2012年07月23日 14:47:09 | anton.barkovsky | set | nosy:
+ anton.barkovsky |
| 2012年07月23日 09:48:37 | slikts | create | |