[New-bugs-announce] [issue6892] optparser example in optparse documentation is broken

Mitchell Model report at bugs.python.org
Sat Sep 12 04:13:00 CEST 2009


New submission from Mitchell Model <mlm at acm.org>:

The help example in the middle of the optparse library documentation is
broken. The code reads:

parser = OptionParser()
parser.add_option("-h", "--help", action="help"),
parser.add_option("-v", action="store_true", dest="verbose",
                  help="Be moderately verbose")
parser.add_option("--file", dest="filename",
                  help="Input file to read data from"),

The result of executing this code is:

optparse.OptionConflictError: option -h/--help: conflicting option
string(s): -h, --help

I see that the documentation says that normally help is added
automatically so you don't need to do it, but doing so shouldn't break
especially since the example shows doing it.

Also, the trailing commas on two of the lines are weird and should be
removed.

----------
assignee: georg.brandl
components: Documentation
messages: 92530
nosy: MLModel, georg.brandl
severity: normal
status: open
title: optparser example in optparse documentation is broken
versions: Python 3.0, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6892>
_______________________________________


More information about the New-bugs-announce mailing list