New submission from Glenn Linderman: I coded up a new program, with a bunch of options, and got the following traceback when I tried to run it:
Traceback (most recent call last): File "D:\my\py\renmany.py", line 273, in <module> args = cmdl.parse_intermixed_args() File "D:\my\py\glu\glu.py", line 1695, in parse_intermixed_args args, argv = self.parse_known_intermixed_args(args, namespace) File "D:\my\py\glu\glu.py", line 1740, in parse_known_intermixed_args namespace, remaining_args = self.parse_known_args(args, namespace) File "C:\Python33\lib\argparse.py", line 1737, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "C:\Python33\lib\argparse.py", line 1943, in _parse_known_args start_index = consume_optional(start_index) File "C:\Python33\lib\argparse.py", line 1883, in consume_optional take_action(action, args, option_string) File "C:\Python33\lib\argparse.py", line 1811, in take_action action(self, namespace, argument_values, option_string) File "C:\Python33\lib\argparse.py", line 1015, in __call__ parser.print_help() File "C:\Python33\lib\argparse.py", line 2339, in print_help self._print_message(self.format_help(), file) File "C:\Python33\lib\argparse.py", line 2323, in format_help return formatter.format_help() File "C:\Python33\lib\argparse.py", line 276, in format_help help = self._root_section.format_help() File "C:\Python33\lib\argparse.py", line 206, in format_help func(*args) File "C:\Python33\lib\argparse.py", line 206, in format_help func(*args) File "C:\Python33\lib\argparse.py", line 513, in _format_action help_text = self._expand_help(action) File "C:\Python33\lib\argparse.py", line 600, in _expand_help return self._get_help_string(action) % params ValueError: unsupported format character ')' (0x29) at index 673 The only thing I can tell is that something went wrong in ArgParse. I had called a bunch of add_argument, and then a parse_known_args. I had passed parameters to the program to get a help message, so that is what I expect parse_known_args is trying to produce... and the call stack seems to confirm that. I didn't intentionally pass a format character ')' anywhere, but there are ')' characters in some of my help messages, so that is probably the source of the problem. No doubt I can reduce the problem space by judiciously commenting out things until I can isolate the particular help message that is causing the failure (it may be more than one as several are similar). But it seems like the exception should include the name of the argument for which the failure occurred. [OK, I isolated, and found a "%)" sequence in one of my messages that should have been "%%)". So this is not terribly urgent, just poor reporting.] ---------- messages: 219778 nosy: v+python priority: normal severity: normal status: open title: Argparse exceptions should include which argument has a problem _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21666> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com