As I thought, it does not fail silently. You need something like:
if not parser.has_section("feeds"): parser.add_section("feeds") Andreas Am Samstag, den 08.03.2008, 16:46 +0000 schrieb dave selby: > Hi All, > > I am using the ConfigParser module, I can 'get' from a config file > fine, when I try to set it, it silently fails. the code. > > parser = ConfigParser.SafeConfigParser() > parser.read('./daemon.rc') > print parser.get('feeds', 'number') > parser.set('feeds', 'number', '99') > print parser.get('feeds', 'number') > > there is a section [feeds], and option number, it is set to 1. If I > execute the script I get ... > > [EMAIL PROTECTED]:/var/lib/kmotion/daemons$ ./daemon_start.py > 1 > 99 > [EMAIL PROTECTED]:/var/lib/kmotion/daemons$ ./daemon_start.py > 1 > 99 > [EMAIL PROTECTED]:/var/lib/kmotion/daemons$ > > > The first call returns as expected, the second should return 99, 99 > not 1, 99. On opening daemons.rc the 'number' option is not changed. > > Any ideas ? > > Cheers > > Dave > > > > > > > > > > > > > >
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor