[issue10387] ConfigParser's getboolean method is broken
Felix Laurie von Massenbach
report at bugs.python.org
Fri Nov 12 01:15:33 CET 2010
Felix Laurie von Massenbach <fantasizer at gmail.com> added the comment:
Ok, so I understand the issue, but why doesn't the set method simply convert to a string?
>>> from ConfigParser import RawConfigParser
>>> from StringIO import StringIO
>>> parser = RawConfigParser()
>>> config = """
[section]
test = True
"""
>>> parser.readfp(StringIO(config))
>>> parser.get("section", "test")
'True'
>>> parser.getboolean("section", "test")
True
>>> parser.set("section", "test", True)
>>> parser.get("section", "test")
True
>>> parser.getboolean("section", "test")
Traceback (most recent call last):
File "<pyshell#33>", line 1, in <module>
parser.getboolean("section", "test")
File "C:\Python27\lib\ConfigParser.py", line 361, in getboolean
if v.lower() not in self._boolean_states:
AttributeError: 'bool' object has no attribute 'lower'
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10387>
_______________________________________
More information about the Python-bugs-list
mailing list