[issue9340] argparse parse_known_args does not work with subparsers

Catherine Devlin report at bugs.python.org
Wed Aug 4 19:45:44 CEST 2010

Catherine Devlin <fredv8vibwc at liquidid.net> added the comment:

This patch fixes it with a fourth approach: if unrecognized arguments are found during subparser parsing, information about them is inserted into the namespace (under "._unrecognized"), and the decision about whether to exit is deferred.  When top-level parsing is finished, those recorded unrecognized args are added to whatever was found by the main parser.  

It passes the tests I submitted yesterday.

Added file: http://bugs.python.org/file18388/unrecognized_args_defer_exit.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list