[Python-bugs-list] [ python-Bugs-583248 ] ConfigParser spaces in keys not read

noreply@sourceforge.net noreply@sourceforge.net
Thu, 18 Jul 2002 01:07:46 -0700


Bugs item #583248, was opened at 2002-07-18 09:07
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=583248&group_id=5470

Category: Extension Modules
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Martin Thopmson (martinthompson)
Assigned to: Nobody/Anonymous (nobody)
Summary: ConfigParser spaces in keys not read

Initial Comment:
ConfigParser will write, but not read keys with spaces in, eg
key with spaces in = 5
 raises a parse exception.

My fix, tested a small amount on one file!:  
Change regexp on Line 390 to
    OPTCRE = re.compile(
        r'(?P<option>[^=:]+?)'      # anything not an = or :, don;t grab the last space, leave for next bit
        r'[ \t]*(?P<vi>[:=])[ \t]*'           # any number of space/tab,
                                              # followed by separator
                                              # (either : or =), followed
                                              # by any # space/tab
        r'(?P<value>.*)$'                     # everything up to eol
        )




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

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