ConfigParser: what read('non-existent-filename') returns in 2.3.x?

Danil Dotsenko dd at accentsolution.com
Thu Jul 20 13:50:40 EDT 2006


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

One user with 2.3.x reported an error stemming from my use of 
len(cfgObject.read('potentially-non-existent-filename'))

File "/home/web/Downloads/afoto-1.5b6.skz/localConf.py", line 53, in load
TypeError: len() of unsized object

Can anyone tell me what cfgObject.read('potentially-non-existent-filename')
returns in 2.3.x?

My output:
>>> import ConfigParser
>>> cfg = ConfigParser.ConfigParser()
>>> a = cfg.read('adsfasfdasfd')
>>> a, len(a), type(a)
([], 0, <type 'list'>)

Thx in advance.

Daniel.



More information about the Python-list mailing list