[ python-Bugs-864063 ] ConfigParser.getint failure on 2.3.3
SourceForge.net
noreply at sourceforge.net
Tue May 18 07:47:45 EDT 2004
Bugs item #864063, was opened at 2003-12-21 19:37
Message generated for change (Comment added) made by zgoda
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=864063&group_id=5470
Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Jarek Zgoda (zgoda)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: ConfigParser.getint failure on 2.3.3
Initial Comment:
It fails with this traceback:
jarek:~/projekty/jpawrk/trunk$ ./jpa.py
Traceback (most recent call last):
File
"/home/jarek/projekty/jpawrk/trunk/lib/jt_mainwindow.py",
line 328, in OnMessageEdit
self.cfg)
File
"/home/jarek/projekty/jpawrk/trunk/lib/jt_msgeditwindow.py",
line 35, in editMessage
dlg = MsgEditDlg(tmp, config)
File
"/home/jarek/projekty/jpawrk/trunk/lib/jt_msgeditwindow.py",
line 69, in __init__
self.__setProperties(config)
File
"/home/jarek/projekty/jpawrk/trunk/lib/jt_msgeditwindow.py",
line 76, in __setProperties
winSize = cfg.getWindowSize('msgedit')
File
"/home/jarek/projekty/jpawrk/trunk/lib/jt_cfg.py", line
66, in getWindowSize
return (self.cp.getint(windowName, 'width'),
File "/usr/lib/python2.3/ConfigParser.py", line 315,
in getint
return self._get(section, int, option)
File "/usr/lib/python2.3/ConfigParser.py", line 312,
in _get
return conv(self.get(section, option))
File "/usr/lib/python2.3/ConfigParser.py", line 518,
in get
return self._interpolate(section, option, value, d)
File "/usr/lib/python2.3/ConfigParser.py", line 557,
in _interpolate
if value.find("%(") != -1:
AttributeError: 'int' object has no attribute 'find'
The offending line in ConfigParser.py is line 553 which
reads:
value = rawval
In case of non-string values this will fail later,
since find() is a string method. Changing this line to:
value = str(rawval)
helps in case of numeric values (didn't check with
booleans, though).
----------------------------------------------------------------------
>Comment By: Jarek Zgoda (zgoda)
Date: 2004-05-18 13:47
Message:
Logged In: YES
user_id=92222
Thanks for clarification. And yes, the value passed to
.set() is of integer type, as may be found in attached script.
I am closing this report with resolution "Fixed".
----------------------------------------------------------------------
Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2004-05-18 05:42
Message:
Logged In: YES
user_id=3066
Are you passing non-string values to the .set() method? The
_interpolate() method is called before ConfigParser even
performs data conversion, so it should only see strings.
The script being run in the traceback you show was not
attached, so I can't be sure how you're using ConfigParser.
The documentation for the .set() method has been found
lacking; this has been fixed in response to another bug
report. Starting with Python 2.4, passing a non-string as
the value to the .set() method will cause a TypeError to be
raised.
If you were *not* passing a non-integer as the value
argument of the .set() method, please respond to this bug
report; a short script that demonstrates the problem would
help us diagnose the problem more carefully.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=864063&group_id=5470
More information about the Python-bugs-list
mailing list