def __init__(self,fullfilepath): self._filepath=fullfilepath if not os.path.isdir(os.path.dirname(fullfilepath)): os.makedirs(os.path.dirname(fullfilepath)) self._conf=ConfigParser.ConfigParser() if os.path.isfile(fullfilepath): try: self._conf.readfp(open(fullfilepath,"r")) except Exception,e: PLOG.error("配置文件'%s'打开失败,err=%s"%(self._filepath,e))
def __init__(self, fullfilepath): self._filepath = fullfilepath if not os.path.isdir(os.path.dirname(fullfilepath)): os.makedirs(os.path.dirname(fullfilepath)) self._conf = ConfigParser.ConfigParser() if os.path.isfile(fullfilepath): try: self._conf.readfp(open(fullfilepath, "r")) except Exception, e: PLOG.error("配置文件'%s'打开失败,err=%s" % (self._filepath, e))
def save(self): try: self._conf.write(open(self._filepath,"w")) except Exception,e: PLOG.error("配置文件'%s'保存失败,err=%s"%(self._filepath,e))
def save(self): try: self._conf.write(open(self._filepath, "w")) except Exception, e: PLOG.error("配置文件'%s'保存失败,err=%s" % (self._filepath, e))