[Web-SIG] ConfigParser

Ian Bicking ianb at colorstudy.com
Fri Mar 9 17:18:50 CET 2007


Since there's lots of talk of ConfigParser, I thought I'd note some code 
  I've written that uses the basic API of ConfigParser but allows for 
some simple additions; in INITools (http://pythonpaste.org/initools/) 
specifically initools.configparser: 
http://pythonpaste.org/initools/initools/configparser.py.html

It keeps track of filenames and line numbers so it's possible to give 
more detailed error messages (though only if you have access to the 
underlying config parser object), and though not enabled by default it 
also includes options for things like "extends" to overlap sections, and 
${section:value} substitution.  Unlike some of the other ConfigParser 
alternatives out there, it doesn't extend the ini syntax or the types 
that ini files deal in (i.e., only strings).

-- 
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org


More information about the Web-SIG mailing list