New submission from Ariel Otilibili Anieli <arielani...@yahoo.fr>: Hello,
When add_mutually_exclusive_group is built without argument, the help breaks with "IndexError: list index out of range". Indeed this snippet: actions_ = parser.add_argument_group('Actions') actions = actions_.add_mutually_exclusive_group() Breaks the help of argparse: # --help Traceback (most recent call last): File "./ovpauto", line 135, in <module> args = parser.parse_args() File "/usr/lib/python2.7/argparse.py", line 1701, in parse_args args, argv = self.parse_known_args(args, namespace) File "/usr/lib/python2.7/argparse.py", line 1733, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "/usr/lib/python2.7/argparse.py", line 1939, in _parse_known_args start_index = consume_optional(start_index) File "/usr/lib/python2.7/argparse.py", line 1879, in consume_optional take_action(action, args, option_string) File "/usr/lib/python2.7/argparse.py", line 1807, in take_action action(self, namespace, argument_values, option_string) File "/usr/lib/python2.7/argparse.py", line 996, in __call__ parser.print_help() File "/usr/lib/python2.7/argparse.py", line 2340, in print_help self._print_message(self.format_help(), file) File "/usr/lib/python2.7/argparse.py", line 2314, in format_help return formatter.format_help() File "/usr/lib/python2.7/argparse.py", line 281, in format_help help = self._root_section.format_help() File "/usr/lib/python2.7/argparse.py", line 211, in format_help func(*args) File "/usr/lib/python2.7/argparse.py", line 319, in _format_usage action_usage = format(optionals + positionals, groups) File "/usr/lib/python2.7/argparse.py", line 390, in _format_actions_usage start = actions.index(group._group_actions[0]) IndexError: list index out of range Moreover, the trace does not say whence the error came from. # uname -a Linux quasar 4.8.0-2-amd64 #1 SMP Debian 4.8.15-2 (2017-01-04) x86_64 GNU/Linux # lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux testing (buster) Release: testing Codename: buster # gcc --version gcc (Debian 7.3.0-17) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # python --version Python 2.7.15rc1 # dpkg -l | grep -P '\s+python\s+.*2.7.15' ii python 2.7.15~rc1-1 amd64 interactive high-level object-oriented language (default version) Regards, Ariel ---------- messages: 316113 nosy: ariel-anieli, bethard priority: normal severity: normal status: open title: When add_mutually_exclusive_group is built without argument, the help breaks with "IndexError: list index out of range" type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33415> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com