Argparse with required subparser
I'm using Python 3.4, I'm trying to use argparse with subparsers, and I want to have a similar behavior to the one in Python 2.x where if I don't supply a positional argument (to indicate the subparser/subprogram) I'll get a helpful error message. I.e., with python2 I'll get the following error message: $ python2 subparser_test.py usage: subparser_test.py [-h] {foo} ... subparser_test.py: error: too few arguments I'm setting the required attribute as suggested in https://stackoverflow.com/a/22994500/3061818 , however that gives me an error with Python 3.4.0: TypeError: sequence item 0: