Sandip Bhattacharya wrote:
On Nov 4, 12:43 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
def main(argv=None):
     if argv is None: argv = sys.argv[1:]
     ...

Wouldn't that make optparse miss the first parameter sys.argv[1]
mistaking it to be the name of the current program?

Nope...optparse uses argv[1:] as documented at [1]. The "prog" argument can be specified in the constructor to OptionParser, but defaults to sys.argv[0] if it's not been explicitly specified.[2]

-tkc


[1]
http://www.python.org/doc/2.5.2/lib/optparse-parsing-arguments.html

[2]
http://www.python.org/doc/2.5.2/lib/optparse-creating-parser.html
(at the "prog" entry at the bottom)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to