diff --git a/userconfig/cfgfile.py b/userconfig/cfgfile.py index f4fe18e..de7f41c 100644 --- a/userconfig/cfgfile.py +++ b/userconfig/cfgfile.py @@ -10,15 +10,16 @@ cfgfile.py Created by Marcus Stoegbauer on 2013-01-12. Copyright (c) 2013 __MyCompanyName__. All rights reserved. """ -from ConfigParser import ConfigParser +import ConfigParser class Conf(object): - confobj = ConfigParser() + confobj = ConfigParser.RawConfigParser() cfgfile = '' def __init__(self, filename = None): """if filename is set, open config file and initialize the ConfigParser """ + self.confobj = ConfigParser.RawConfigParser() if filename: self.setfilename(filename) # if filename @@ -27,7 +28,8 @@ class Conf(object): def setfilename(self, filename): """initialize the ConfigParser """ - if len(self.confobj.read(filename)) == 0 or self.confobj.read(filename)[0] != filename: + ret = self.confobj.read(filename) + if len(ret) == 0 or ret[0] != filename: raise Exception('Cannot read config file ' + filename) # if cannot read self.cfgfile = filename