[docs] [issue37717] argparse subcommand docs has non-existent parameter "action"

paul j3 report at bugs.python.org
Tue Jul 30 13:28:04 EDT 2019


paul j3 <ajipanca at gmail.com> added the comment:

As discussed in https://bugs.python.org/issue23487, `action` works if the class is compatible with argparse._SubParsersAction.

these commands all do the same thing:

    parser.add_subparsers()       # default
    parser.add_subparsers(action='parsers')  
    parser.add_subparsers(action=argparse._SubParsersAction) 

Your example using 

    parser.add_subparsers(action='store')

raises the error because the argparse._StoreAction class cannot handle the `parser_class` parameter that add_subparsers has added to the kwargs.

----------

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


More information about the docs mailing list