On Mon, Sep 19, 2011 at 1:22 PM, Mina Nozar <[email protected]> wrote:

> **
> I don't really understand what dest and action in the arguments to
> parser.add_option mean.
> Any help is appreciated.
>

Have you read the fine manual, specifically the sections here:
http://docs.python.org/library/optparse.html#optparse-standard-option-actions

and here:
http://docs.python.org/library/optparse.html#option-attributes

Additionaly, I'm not sure you copied your code correctly, because after a
copy and paste I get this:

$ python localtest.py
Traceback (most recent call last):
  File "localtest.py", line 5, in <module>
    parser.add_option("-cvs", dest="output", default=True, help="outputs the
csv file for plotting activites")
  File "/usr/lib/python2.6/optparse.py", line 1012, in add_option
    option = self.option_class(*args, **kwargs)
  File "/usr/lib/python2.6/optparse.py", line 566, in __init__
    self._set_opt_strings(opts)
  File "/usr/lib/python2.6/optparse.py", line 606, in _set_opt_strings
    self)
optparse.OptionError: invalid long option string '-cvs': must start with --,
followed by non-dash

and when I correct that:

$ python localtest.py -h

uwwerne@WWERNER /c
$

I get no output.

HTH,
Wayne
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to