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 louielu
Recipients louielu
Date 2017-04-26.02:33:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When adding mutually exclusive group and required is True, and the group argument has default value. If we type its default value, argparse will ignore the input and return `argument is required`

------- PoC --------
import argparse

parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('-v', type=int, default=10)



$ python -v 10
usage: [-h] -v V error: one of the arguments -v is required
$ python -v 11
Date User Action Args
2017-04-26 02:33:05louielusetrecipients: + louielu
2017-04-26 02:33:05louielusetmessageid: <>
2017-04-26 02:33:05louielulinkissue30163 messages
2017-04-26 02:33:04louielucreate