Problem with argument parsing
steven.bethard at gmail.com
Wed Oct 10 20:21:09 CEST 2007
Diez B. Roggisch wrote:
> lgwe wrote:
>> On 9 Okt, 17:18, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
>>> lgwe wrote:
>>>> I have a python-script: myscript, used to start a program on another
>>>> computer and I use OptionParser in optpars.
>>>> I use it like this: myscript -H host arg1 -x -y zzz
>>>> I would like OptionParser to ignore all arguments after arg1, because
>>>> these are options that should be used by the program started on the
>>>> oter computer arg1 -x -y zzz.
>>>> One solution is to write: myscript -H host "arg1 -x -y zzz"
>>>> But is it in some way possible to instruct OptionParser to ignore -x -
>>>> y zzz without the "..."?
>>> Use -- to separate arguments to be parsed by OptionParser from the
>>> to-be-ignored-ones, which is documented btw.
>> I understand that this must be documented.
>> But I can't find if anywhere in
>> http://docs.python.org/lib/module-optparse.html. (maybee I just cant see
>> it, but it is there)
> It's general unix-commandline-knowledge... but you are right of course. It
> should be documented. Maybe you can file a documentation-bug or something?
Note that optparse is (unfortunately) maintained separately from the
rest of Python. You'll need to file bug reports at the optik bug tracker:
More information about the Python-list