Message285877
http://bugs.python.org/issue9253 argparse: optional subparsers
Initially this bug/issue was a request to allow subparsers to be optional. But with the change in how required actions are handled, subparsers are now optional by default.
As you learned from the SO question you now have to specify
subparsers.required = True
This is also discussed in my post (and following ones)
http://bugs.python.org/issue9253#msg186387
The default 'dest' is SUPPRESS. The error you report occurs because the 'required' error mechanism cannot handle that value. The suggest fix is to assign `dest`, even if it is not needed in the Namespace. For now it is needed for error reporting.
Reviewing my suggested patches, it looks like I generate a 'dest' substitute from the subparser names. So the 'required' error would look like
python: error: the following arguments are required: {cmd1, cmd2}
I think this issue can be closed with a reference to 9253. Or maybe that issue is too old, long and confusing, and we need a new bug/issue. |
|
Date |
User |
Action |
Args |
2017-01-20 05:38:54 | paul.j3 | set | recipients:
+ paul.j3, zachrahan |
2017-01-20 05:38:54 | paul.j3 | set | messageid: <1484890734.49.0.690486182916.issue29298@psf.upfronthosting.co.za> |
2017-01-20 05:38:54 | paul.j3 | link | issue29298 messages |
2017-01-20 05:38:53 | paul.j3 | create | |
|