zenlotus / argparse

Automatically exported from code.google.com/p/argparse
Other
0 stars 0 forks source link

Value passed to command-line option cannot take a string that includes another command-line option #68

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

I have a program that will run other programs.  I'd like to be able to pass
in the arguments to the other program from the commandline like so:

    envb py.nosetest -a  '-a unit'
    envb py.nosetest --nose-arguments='-a unit'

If it's any help, here's the add_argument call:

        parser.add_argument('-a', '--nose-arguments',
                            help = "Arguments to pass to nose")

What is the expected output? What do you see instead?

There's not really any expected output at this point as this is an
experiment.  However, I'm currently getting the following error for the
first version:

usage: envb py.nosetest [-h] [-p PARCELS] [-v VERBOSE] [--version]
                        [-a NOSE_ARGUMENTS]
envb py.nosetest: error: argument -a/--nose-arguments: expected one argument

It seems as though this error will come up if it contains any of the valid
one letter arguments.  So this will also produce an error:

envb py.nosetest -a  '-v unit'

...but this won't:

envb py.nosetest -a  '-b unit'

What version of the product are you using? On what operating system?

I've verified that this happens under versions 1.1.0 and 1.0.1

Original issue reported on code.google.com by amnorv...@gmail.com on 24 Mar 2010 at 3:57

GoogleCodeExporter commented 9 years ago
This breaks existing programs like a2x when porting them to argparse from the 
now-deprecated optparse.

http://bugs.python.org/issue9334

Original comment by andersk@mit.edu on 22 Jul 2010 at 10:17

GoogleCodeExporter commented 9 years ago
Moved to bugs.python.org

Original comment by steven.b...@gmail.com on 23 Jul 2010 at 1:36