[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

Lucas Cimon report at bugs.python.org
Fri May 21 03:02:44 EDT 2021


Lucas Cimon <lucas.cimon at gmail.com> added the comment:

Reporting a duplicate / superseder with the following bug:

parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(required=True)
subparsers.add_parser('foo')
parser.parse_args()

Raising:

TypeError: sequence item 0: expected str instance, NoneType found

It has already been reported in https://bugs.python.org/issue29298
with an interesting solution by Greg Minshall.

----------
nosy: +Lucas Cimon

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


More information about the Python-bugs-list mailing list