[New-bugs-announce] [issue1243] option.dest not set when callback called with optparse

Chris Withers report at bugs.python.org
Sat Oct 6 18:03:12 CEST 2007

New submission from Chris Withers:

The attached script demonstrates the bug.

option.dest should be set, even if not explicitly supplied in the call
to parser.add_option, by the time the callback is called.

Unless dest='something' is specified in the call to add_option, you will
get the following error when running "python test.py --myopt":

  File "test.py", line 4, in mycallback
TypeError: attribute name must be string

...as options.dest is still None.

I would expect options.dest to be computed as per the algorithm in

components: Library (Lib)
files: test.py
messages: 56252
nosy: cjw296
severity: normal
status: open
title: option.dest not set when callback called with optparse
versions: Python 2.3, Python 2.4, Python 2.5

Tracker <report at bugs.python.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 276 bytes
Desc: not available
Url : http://mail.python.org/pipermail/new-bugs-announce/attachments/20071006/0d9d745d/attachment.py 

More information about the New-bugs-announce mailing list