[Python-bugs-list] [Bug #132288] Config Parser .ini "Gotcha"

noreply@sourceforge.net noreply@sourceforge.net
Wed, 14 Feb 2001 07:37:16 -0800


Bug #132288, was updated on 2001-Feb-13 17:22
Here is a current snapshot of the bug.

Project: Python
Category: Python Library
Status: Closed
Resolution: Fixed
Bug Group: Feature Request
Priority: 5
Submitted by: nobody
Assigned to : fdrake
Summary: Config Parser .ini "Gotcha"

Details: Problem:  
I'm working on a windows-specific app, which makes heavy use of .ini files.
 A lot of our section names are in the form [WorkClass\WorkType]. 
ConfigParser currently chokes on that style section name.

I couldn't tell whether this is legal according to the RFC on which this is
based.  But it's required for what we're doing.

Fix:
My version of ConfigParser.py has this statement beginning at 381.  The
change is so small that it doesn't seem worth actually doing a full-blown
diff.

Anyway.  Change:
SECTCRE = re.compile(
    r'\['                                 # [
    r'(?P<header>[-\w_.*,(){} ]+)'        # comment here
    r'\]'                                 # ]
        )

to:
SECTCRE = re.compile(
    r'\['                                 # [
    r'(?P<header>[-\w_.*,(){} \\]+)'      # same comment
    r'\]'                                 # ]
        )

And the problem goes away.

My apologies for not logging in.  I'm submitting this from work, and they
won't allow us to upgrade IE (which Source Forge says it requires).

Thanks!



Follow-Ups:

Date: 2001-Feb-14 07:37
By: fdrake

Comment:
Fixed in a fairly permissive way in Lib/ConfigParser.py revision 1.31, in
the hope that this problem will not re-surface with some other character in
the next release of Python.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=132288&group_id=5470