New submission from Chris Bruner: When reading options from a file, argparse should read all <nargs> values from each line. Instead, it complains of there not being enough options.
python file: #!/usr/bin/env python import argparse p = argparse.ArgumentParser(description='Reproduce argparse nargs file bug', fromfile_prefix_chars='@') p.add_argument('-t', '--triple', metavar='N', nargs=3) args = p.parse_args(['@input.opts']) print args input.opts: --triple 1 2 3 -t 2 2 32 Output: bernoulli:myclu cwbrune$ argparse_nargs_file_bug.py usage: argparse_nargs_file_bug.py [-h] [-t N N N] argparse_nargs_file_bug.py: error: argument -t/--triple: expected 3 argument(s) ---------- files: argparse_nargs_file_bug.py messages: 223753 nosy: Chris.Bruner priority: normal severity: normal status: open title: argparse: read nargs > 1 options from file doesn't work type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file36049/argparse_nargs_file_bug.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22050> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com