[issue29298] argparse fails with required subparsers, un-named dest, and empty argv

Mathias Ettinger report at bugs.python.org
Tue Nov 20 10:37:01 EST 2018


Mathias Ettinger <mathias.ettinger at gmail.com> added the comment:

I was just hit by the very same issue and added the following test into `_get_action_name` to work around it:

    elif isinstance(argument, _SubParsersAction):
        return '{%s}' % ','.join(map(str, argument.choices))

I checked #9253 as referenced by paul j3 and like the `argument.name()` approach as well as it's less specific.

Any chance this can be addressed one way or another?

----------
nosy: +Mathias Ettinger

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


More information about the Python-bugs-list mailing list