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.

classification
Title: argparse subcommand action can't be specified
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: argparse: add_subparsers 'action' broken
View: 23487
Assigned To: Nosy List: berker.peksag, spaceone
Priority: normal Keywords:

Created on 2015-03-25 10:37 by spaceone, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg239246 - (view) Author: SpaceOne (spaceone) * Date: 2015-03-25 10:37
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.
msg239247 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-03-25 10:44
Thanks for the report. This is a duplicate of issue 23487.
History
Date User Action Args
2022-04-11 14:58:14adminsetgithub: 67965
2015-03-25 10:44:38berker.peksagsetstatus: open -> closed

superseder: argparse: add_subparsers 'action' broken
nosy: + berker.peksag

messages: + msg239247
type: crash -> behavior
resolution: duplicate
stage: resolved
2015-03-25 10:37:25spaceonecreate