[New-bugs-announce] [issue1784] Error with OptionParser.parse_args()
Raghuram Devarakonda
report at bugs.python.org
Thu Jan 10 18:09:52 CET 2008
New submission from Raghuram Devarakonda:
Sorry for the generic title but I couldn't think of a better one. My
attempt to do "svn up && make" failed with the following exception from
setup.py:
----------------------
File "./setup.py", line 314, in detect_modules
if options.dirs:
AttributeError: Values instance has no attribute 'dirs'
----------------------
I isolated the problem to a small script.
----------------------
import optparse
parser = optparse.OptionParser()
parser.add_option("-I", dest="dirs", action="append")
options = parser.parse_args(['-I.', '-IInclude', '-I./Include'])[0]
if options.dirs:
print "opt = ", options.dirs
----------------------
When run with 2.5.1, the script prints "opt = ['.', 'Include',
'./Include']" but python from trunk gives the error:
Traceback (most recent call last):
File "../opttest.py", line 6, in <module>
if options.dirs:
AttributeError: Values instance has no attribute 'dirs'
----------
components: Library (Lib)
messages: 59672
nosy: draghuram
severity: normal
status: open
title: Error with OptionParser.parse_args()
type: behavior
versions: Python 2.6
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1784>
__________________________________
More information about the New-bugs-announce
mailing list