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: ConfigParser get methods broken
Type: crash Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Absynthe
Priority: normal Keywords:

Created on 2009-03-03 05:37 by Absynthe, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg83055 - (view) Author: Sylvain Rabot (Absynthe) Date: 2009-03-03 05:37
Python 3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

    ****************************************************************
    Personal firewall software may warn about the connection IDLE
    makes to its subprocess using this computer's internal loopback
    interface.  This connection is not visible on any external
    interface and no data is sent to or received from the Internet.
    ****************************************************************
    
IDLE 3.0      
>>> from configparser import ConfigParser
>>> config = ConfigParser()
>>> config.add_section("popo")
>>> config.set("popo", "int", 123)
>>> config.getint("popo", "int")
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    config.getint("popo", "int")
  File "c:\Python30\lib\configparser.py", line 340, in getint
    return self._get(section, int, option)
  File "c:\Python30\lib\configparser.py", line 337, in _get
    return conv(self.get(section, option))
  File "c:\Python30\lib\configparser.py", line 545, in get
    return self._interpolate(section, option, value, d)
  File "c:\Python30\lib\configparser.py", line 585, in _interpolate
    if "%(" in value:
TypeError: argument of type 'int' is not iterable
>>> config.set("popo", "bool", True)
>>> config.getboolean("popo", "bool")
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    config.getboolean("popo", "bool")
  File "c:\Python30\lib\configparser.py", line 349, in getboolean
    v = self.get(section, option)
  File "c:\Python30\lib\configparser.py", line 545, in get
    return self._interpolate(section, option, value, d)
  File "c:\Python30\lib\configparser.py", line 585, in _interpolate
    if "%(" in value:
TypeError: argument of type 'bool' is not iterable
>>> config.set("popo", "float", 3.21)
>>> config.getfloat("popo", "float")
Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    config.getfloat("popo", "float")
  File "c:\Python30\lib\configparser.py", line 343, in getfloat
    return self._get(section, float, option)
  File "c:\Python30\lib\configparser.py", line 337, in _get
    return conv(self.get(section, option))
  File "c:\Python30\lib\configparser.py", line 545, in get
    return self._interpolate(section, option, value, d)
  File "c:\Python30\lib\configparser.py", line 585, in _interpolate
    if "%(" in value:
TypeError: argument of type 'float' is not iterable

Same things with python 2.6
msg83056 - (view) Author: Sylvain Rabot (Absynthe) Date: 2009-03-03 06:13
My bad, ConfigParser.set() needs string values apparently.
History
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49659
2009-03-03 15:06:29draghuramsetstatus: open -> closed
resolution: not a bug
2009-03-03 06:13:48Absynthesetmessages: + msg83056
2009-03-03 05:37:11Absynthecreate