ConfigParser: writes a list but reads a string?

Fuzzyman fuzzyman at gmail.com
Mon Jan 23 10:31:29 EST 2006


Jeffrey Barish wrote:
> funkyj wrote:
>
> > making the config file XML and using xml.dom is another option,
> > although XML is a bit ugly to edit by hand.
> >   --jfc
> >
> I am seriously intrigued by ConfigObj.  I am currently using an crude
> improvisation involving tab-delimited fields to store metadata for
> recordings -- not configuration data -- in text files.  I had been planning
> to convert to XML, but now I am wondering whether ConfigObj would be
> easier.  I would like for the metadata files to be editable, but editing
> does not have to be easy as it needs to be done rarely.  I've never used
> XML, so I am wondering whether there are other tradeoffs between that
> approach and ConfigObj that I should be aware of.  I was thinking of XML
> mainly to have a more robust format.  For example, it would be nice if it
> were possible to add fields without obsoleting early versions of the
> reader.  Crossplatform compatibility is also desirable.

ConfigObj can be used for all sorts of data persistence type uses.
Because it is pure python there are likely to be no cross platform
issues.

You would have to 'name' entries, but entries can be single values or
lists - or even subsections (effectively dictionaries).

If you are happy with text, then it is *very* easy to use. If you
wanted to store other datatypes, then you may be interested in
ConfigPersist.py :


http://www.voidspace.org.uk/python/articles/configobj_for_data_persistence.shtml

It is easy to use a validating configspec, and then extend it - without
obsoleting earlier code or data files.

All the best,

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml

> -- 
> Jeffrey Barish




More information about the Python-list mailing list