New submission from Serhiy Ivanov: have 1.py as: import argparse import sys print (sys.argv) parser = argparse.ArgumentParser(prog='demo') parser.add_argument('--host -h', help='host for the server of %(prog)', nargs=1, required=True, metavar='<host>') parser.add_argument('--port -p', help='port for the server of %(prog)', nargs=1, required=True, metavar='<port>') parser.parse_args(sys.argv)
and run C:\Python34\python.exe 1.py -h 1. Will obtain: Traceback (most recent call last): File "1.py", line 7, in <module> parser.parse_args(sys.argv) File "C:\Python34\lib\argparse.py", line 1717, in parse_args args, argv = self.parse_known_args(args, namespace) File "C:\Python34\lib\argparse.py", line 1749, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "C:\Python34\lib\argparse.py", line 1955, in _parse_known_args start_index = consume_optional(start_index) File "C:\Python34\lib\argparse.py", line 1895, in consume_optional take_action(action, args, option_string) File "C:\Python34\lib\argparse.py", line 1823, in take_action action(self, namespace, argument_values, option_string) File "C:\Python34\lib\argparse.py", line 1016, in __call__ parser.print_help() File "C:\Python34\lib\argparse.py", line 2348, in print_help self._print_message(self.format_help(), file) File "C:\Python34\lib\argparse.py", line 2332, in format_help return formatter.format_help() File "C:\Python34\lib\argparse.py", line 278, in format_help help = self._root_section.format_help() File "C:\Python34\lib\argparse.py", line 208, in format_help func(*args) File "C:\Python34\lib\argparse.py", line 208, in format_help func(*args) File "C:\Python34\lib\argparse.py", line 515, in _format_action help_text = self._expand_help(action) File "C:\Python34\lib\argparse.py", line 602, in _expand_help return self._get_help_string(action) % params ValueError: incomplete format ---------- components: Library (Lib) messages: 220432 nosy: icegood priority: normal severity: normal status: open title: argvars: error while parsing under windows versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21747> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com