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 paul.j3
Recipients Arfrever, asvetlov, bethard, epicfaace, maker, paul.j3, r.david.murray, telmich
Date 2019-08-25.00:50:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1566694208.95.0.731764671762.issue16308@roundup.psfhosted.org>
In-reply-to
Content
https://bugs.python.org/issue26510

https://bugs.python.org/issue33109

There was some flip/flop over whether required should be true by default or not - the current behavior is False, (the 3.3.0)

The lasting change since this issue in 2012 is that `add_subparsers` now takes the 'required' parameter.  And this is documented.

To avoid the problem raising in this issue, the subparsers should be defined with:

    p1 = parser.add_subparsers(required=True, dest='cmd')

The 'dest' parameter is documented, but that fact that it is needed with required=True is not.  Without it you can get an error when missing-argument is being formatted.  Without it the error formatter doesn't know what to call this argument.   I've mentioned this in one or more issues.

See my SO answer for discussion on this:

https://stackoverflow.com/questions/23349349/argparse-with-required-subparser/23354355#23354355
History
Date User Action Args
2019-08-25 00:50:08paul.j3setrecipients: + paul.j3, bethard, Arfrever, r.david.murray, asvetlov, maker, telmich, epicfaace
2019-08-25 00:50:08paul.j3setmessageid: <1566694208.95.0.731764671762.issue16308@roundup.psfhosted.org>
2019-08-25 00:50:08paul.j3linkissue16308 messages
2019-08-25 00:50:08paul.j3create