New submission from Reuben Thomas: In Python 3.5.2, with a positional argument with nargs='*', running the program with no arguments gives an error like this:
usage: caffeinate [-h] [-V] COMMAND [ARGUMENT [ARGUMENT ...]] caffeinate: error: the following arguments are required: COMMAND, ARGUMENT Here it is clear from the (correct, though redundant) syntax that "ARGUMENT" is optional, but the error message claims, incorrectly, that it is required. The add_argument calls used were: parser.add_argument('COMMAND', help='command to run') parser.add_argument('ARGUMENT', nargs='*', help='arguments to COMMAND') parser.add_argument('-V', '--version', action='version', version=PROGRAM_NAME + ' ' + VERSION) ---------- components: Library (Lib) messages: 280052 nosy: rrt priority: normal severity: normal status: open title: argparse claims '*' positional argument is required in error output type: behavior versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28609> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com