[Python-bugs-list] [Bug #124324] Python 2.0/ConfigParser: "remove_option" raises "NameError"

noreply@sourceforge.net noreply@sourceforge.net
Mon, 4 Dec 2000 05:32:37 -0800


Bug #124324, was updated on 2000-Dec-04 00:16
Here is a current snapshot of the bug.

Project: Python
Category: Library
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Submitted by: andijust
Assigned to : fdrake
Summary: Python 2.0/ConfigParser: "remove_option" raises "NameError"

Details: When calling method "remove_option" on an existing option, this will raise exceptio NameError:

Skript:
import ConfigParser
a=ConfigParser.ConfigParser()
a.read("t.cfg")
a.remove_option("sec1","opt12")

cfg file I used:
[sec1]
opt11=11
opt12=12
opt13=13

Error message:
Traceback (most recent call last):
  File "t", line 4, in ?
    a.remove_option("sec1","opt12")
  File "/users/dxcasi/user15/justa/tmp/Python-2.0/alpha/V4.0/lib/python2.0/ConfigParser.py", line 364, in remove_option
    existed = sectdict.has_key(key)
NameError: There is no variable named 'key'


Follow-Ups:

Date: 2000-Dec-04 05:32
By: gvanrossum

Comment:
Methinks 'key' should be 'option' in the source code.

Extra points for adding a full test suite for ConfigParser -- there have been way too many embarrassing bug reports about it.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=124324&group_id=5470