editing a config file
Mike Zupan
mzupan at meso.com
Tue Feb 17 15:14:31 EST 2004
I need to edit the value(s) of a config file via a GUI interface. I'm
trying to use ConfigParser but set() doesn't seem to write.
Here are my reading and writing functions
def getConfig(self,value=None):
config = ConfigParser.ConfigParser()
config.readfp(open('config.inf'))
return config.defaults()[value]
def setConfig(self, option, value):
config = ConfigParser.ConfigParser()
config.readfp(open('config.inf', 'a'))
config.set("DEFAULT", option, value)
The values are getting passed ok it just won't set the value to the
new value i have selected.
can anyone offer any hints?
More information about the Python-list
mailing list