[New-bugs-announce] [issue23777] argparse subcommand action can't be specified

SpaceOne report at bugs.python.org
Wed Mar 25 11:37:25 CET 2015

New submission from SpaceOne:

parser.add_subparsers(dest='arguments', action='append')
will raise the following exception:

  File "/usr/lib/python2.7/argparse.py", line 1675, in add_subparsers
    action = parsers_class(option_strings=[], **kwargs)
TypeError: __init__() got an unexpected keyword argument 'prog'

Instead of 'argparse._SubParsersAction' the class 'argparse._AppendAction' is used.
Could maybe fixed by passing the 'action' parameter to the _SubParsersAction class which then instanciates a _AppendAction and somehow uses this internally for further things.

components: Library (Lib)
messages: 239246
nosy: spaceone
priority: normal
severity: normal
status: open
title: argparse subcommand action can't be specified
type: crash
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list