config files in python

Jorge Vargas jorge.vargas at gmail.com
Tue May 6 02:36:07 EDT 2008


On Tue, May 6, 2008 at 2:00 AM, sandipm <sandip.more at gmail.com> wrote:

>
>  here I would like to have python file which read conf from text file
>  and load those params in current process space.
>  so only importing that python file should read up the conf file and
>  load the current process with configurable parameters.
>  I thought this would be good way to do it, rather than getting
>  involved in slightly complicted reload mechanisms of python modules?
>
I think you should work your way into a proper configuration system.

for ones you can use the buildin module
http://docs.python.org/lib/module-ConfigParser.html

or migrate to the more powerful configObj
http://www.voidspace.org.uk/python/configobj.html
>

with configobj, you will have an instance in memory that you can
modify on runtime with a gui or something and when you hit save it
will rewrite the new config file.
>
>  Regards,
>  Sandip
>
>
>
>  --
>  http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list