argparse ConfigureAction problem

Jason Friedman jason at powerpull.net
Mon Mar 26 20:57:51 EDT 2012


> ./plot_stuff2.py --plot stuff1 stuff2
> [...]
> plot_stuff2.py: error: argument --plot/--with-plot/--enable-plot/--no-plot/--
> without-plot/--disable-plot: invalid boolean value: 'stuff1'
>
> Problem is --plot takes an optional argument, and so the positional arg is
> assumed to be the arg to --plot.  Not sure how to fix this.

Maybe have a look at nargs='*' in
http://docs.python.org/py3k/library/argparse.html#nargs.



More information about the Python-list mailing list