[issue23058] argparse silently ignores arguments

Rémi Rampin report at bugs.python.org
Mon Dec 15 22:02:07 CET 2014


New submission from Rémi Rampin:

This works correctly on Python 3.4.

On Python 2.7, argparse seems to completely and silently ignore arguments in some conditions, for instance this setup will cause --verbose to be ignored on the main parser:

    options = argparse.ArgumentParser(add_help=False)
    options.add_argument('-v', '--verbose', action='store_true')
    parser = argparse.ArgumentParser(parents=[options])
    subparsers = parser.add_subparsers()
    parser_cmd = subparsers.add_parser('cmd', parents=[options])

Full runnable example here: http://paste.pound-python.org/show/XfVVhdJHSPISXLP1lASd/

Might or might not be related to #9351, workarounds welcome.

----------
components: Library (Lib)
messages: 232679
nosy: remram
priority: normal
severity: normal
status: open
title: argparse silently ignores arguments
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23058>
_______________________________________


More information about the Python-bugs-list mailing list