On Thu, Jul 20, 2006 at 02:01:08PM -0700, Danil Dotsenko wrote: > Chris Lambacher wrote: > > On Thu, Jul 20, 2006 at 10:50:40AM -0700, Danil Dotsenko wrote: > >> Wrote a little "user-friedly" wrapper for ConfigParser for a KDE's > >> SuperKaramba widget. > >> (http://www.kde-look.org/content/show.php?content=32185) > >> > >> I was using 2.4.x python docs as reference and > >> ConfigParser.read('non-existent-filename') returns [] in 2.4.x > > http://docs.python.org/lib/RawConfigParser-objects.html > > That agrees with the docs since read returns a list of successfully parsed > > filenames. Note the docs also say this was added in 2.4. > > I just looked at the > http://www.python.org/doc/2.3.5/lib/RawConfigParser-objects.html > (note the version number) and see the following: > "If none of the named files exist, the ConfigParser instance will contain an > empty dataset." Which to me means []. To the least of it, the statement > should be clarified, but I would still kindly prefer to have someone > respond / confirm the procedure bellow gives different results in 2.3.x. That says nothing about the return value. It says that the ConfigParser object will contain an empty data set, ie: config.sections() == [] NOT config.read(['doesnotexist.cfg']) == []
since config.read does not explicitly return anything, and therefore you get None. > > >> >>> import ConfigParser > >> >>> cfg = ConfigParser.ConfigParser() > >> >>> a = cfg.read('adsfasfdasfd') > >> >>> a, len(a), type(a) > >> ([], 0, <type 'list'>) > > Thx in advance. > > > > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list