This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Error with OptionParser.parse_args()
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: draghuram
Priority: normal Keywords:

Created on 2008-01-10 17:09 by draghuram, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg59672 - (view) Author: Raghuram Devarakonda (draghuram) (Python triager) Date: 2008-01-10 17:09
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'
msg59674 - (view) Author: Raghuram Devarakonda (draghuram) (Python triager) Date: 2008-01-10 17:32
It is my mistake. I modified optparse.py for an earlier issue and that
change is the cause of the problem reported here. Please close it as
invalid.
History
Date User Action Args
2022-04-11 14:56:29adminsetgithub: 46117
2008-01-10 17:35:46gvanrossumsetstatus: open -> closed
resolution: not a bug
2008-01-10 17:32:45draghuramsetmessages: + msg59674
2008-01-10 17:09:47draghuramcreate