[Tutor] Problems with ConfigParser set method

Alan Gauld alan.gauld at btinternet.com
Sat Mar 8 19:29:01 CET 2008


"dave selby" <dave6502 at googlemail.com> wrote in message 
news:f52017b60803080846j6ee098dp955403011c1548d2 at mail.gmail.com...
> 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')

I've  not used this module but since you have a read at the start
shouldn't you use a write at the end? Otherwise it will only be
set in memory I presume?

Alan G 




More information about the Tutor mailing list