What's better, ConfigObj or ConfigParser?

Apocryphon picture Apocryphon · Aug 6, 2010 · Viewed 9.3k times · Source

Which is better for creating a settings file for Python programs, the built-in module (ConfigParser), or the independent project (ConfigObj)?

Answer

rdchambers picture rdchambers · Dec 18, 2010

I recently switched from configparser to configobj, and I'm thrilled to have done so.

For me, the big difference is configobj's validator. It lets me very easily/succinctly (1) define the type and acceptable values for each entry, and (2) set defaults.

Those two features save me a lot of code and prevent a lot from going wrong. Plus, there's really no extra overhead to using configobj in terms of the complexity of my code, and the library is quite small.