paul j3 <ajipa...@gmail.com> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue16308>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to