Problem with OptionParser

Berthold Höllmann bhoel at web.de
Wed Feb 25 14:56:52 EST 2004


Florian Lindner <Florian.Lindner at xgm.de> writes:

> Hello,
> I've this tiny Python sample:
>
> - - - -
> #!/usr/bin/python
>
> from optparse import OptionParser, OptionValueError
>
> def option_callback(option, opt, value, parser, *args, **kwargs):
>     pass
>
> optparser = OptionParser()
> optparser.add_option("-t", "--type", action="callback",
> callback=option_callback, type="string")
> (options, arguments) = optparser.parse_args()
> - - - -

As a workaround you could set "metavar", I posted a first fix to the
Optik mailing list.

Regards

Berthold
-- 
bhoel at web.de / http://starship.python.net/crew/bhoel/



More information about the Python-list mailing list