[issue18943] argparse: default args in mutually exclusive groups

paul j3 report at bugs.python.org
Wed Dec 6 12:43:10 EST 2017


paul j3 <ajipanca at gmail.com> added the comment:

Did you copy the output right?  Testing your parser:

Without any arguments, I get the exclusive group error - the group is required:

0930:~/mypy/argdev$ python3 issue18943.py 
usage: issue18943.py [-h]
                     (--device-get-capabilities | --ptz-absolute-move x y z | --ptz-get-status MEDIA_PROFILE)
issue18943.py: error: one of the arguments --device-get-capabilities --ptz-absolute-move --ptz-get-status is required

0931:~/mypy/argdev$ python3 --version
Python 3.5.2

With one flag but not its argument, I get the error that you display.  That has nothing to do with the grouping.

0932:~/mypy/argdev$ python3 issue18943.py --ptz-get-status
usage: issue18943.py [-h]
                     (--device-get-capabilities | --ptz-absolute-move x y z | --ptz-get-status MEDIA_PROFILE)
issue18943.py: error: argument --ptz-get-status: expected one argument

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue18943>
_______________________________________


More information about the Python-bugs-list mailing list