ConfigParser and newlines

Minesh Patel minesh at gmail.com
Fri May 15 23:31:35 CEST 2009


> Not as best I can tell.  From my /usr/lib/python2.5/ConfigParser.py file,
> around line 441:
>
>  if line[0].isspace() and cursect is not None and optname:
>    value = line.strip()
>    if value:
>      cursect[optname] = "%s\n%s" % (cursect[optname], value)
>
> That "value = line.strip()" is what's throwing away your extra newline.
>  Then the "if value" refuses to add the extra newline because it was a blank
> line.  It looks like this behavior was intentional?
>

Is that a bug? What would be the use cases for stripping newlines
unnecessarily. Seems like the configParser is trying to be too clever.

-- 
Thanks,
./Minesh



More information about the Python-list mailing list