I thought the set method of the ConfigParser module updates the specified field, but it seems that the change remains only in memory and does not fall into the configuration file. Is this normal behavior?
I also tried the write method, but I got another replicated section, which is not what I want so far.
Here is a sample that represents what I am doing:
import sys import ConfigParser if __name__=='__main__': cfg=ConfigParser.ConfigParser() path='./../whatever.cfg/..' c=cfg.read(path) print cfg.get('fan','enabled') cfg.set('fan','enabled','False') c=cfg.read(path) print cfg.get('fan','enabled')
source share