[ python-Bugs-1603688 ] SaveConfigParser.write() doesn't quote %-Sign

SourceForge.net noreply at sourceforge.net
Mon Nov 27 13:15:17 CET 2006


Bugs item #1603688, was opened at 2006-11-27 13:15
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1603688&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Rebecca Breu (rbreu)
Assigned to: Nobody/Anonymous (nobody)
Summary: SaveConfigParser.write() doesn't quote %-Sign

Initial Comment:
>>> parser = ConfigParser.SafeConfigParser()
>>> parser.add_section("test")
>>> parser.set("test", "foo", "bar%bar")
>>> parser.write(open("test.config", "w"))
>>> parser2 = ConfigParser.SafeConfigParser()
>>> parser2.readfp(open("test.config"))
>>> parser.get("test", "foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/ConfigParser.py", line 525, in get
    return self._interpolate(section, option, value, d)
  File "/usr/lib/python2.4/ConfigParser.py", line 593, in _interpolate
    self._interpolate_some(option, L, rawval, section, vars, 1)
  File "/usr/lib/python2.4/ConfigParser.py", line 634, in _interpolate_some
    "'%%' must be followed by '%%' or '(', found: %r" % (rest,))
ConfigParser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%bar'


Problem: SaveConfigParser saves the string "bar%bar" as is and not as "bar%%bar".

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1603688&group_id=5470


More information about the Python-bugs-list mailing list