Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import json
- class PyCRCtrl(object):
- config = {}
- path = ""
- def loadConfigFile(self):
- if self.path == None:
- return False
- self.config = json.load(open(os.path.join(self.path, "pycrctrl.conf"),"r"))
- return True
- def getConfigEntry(self, entry=""):
- if type(self.config) != dict:
- return
- try:
- return self.config[entry]
- except KeyError:
- return
- def setConfigEntry(self, entry="", value=None):
- if type(self.config) != dict:
- return
- try:
- self.config[entry] = value
- finally:
- json.dump(self.config, open(os.path.join(self.path, "pycrctrl.conf"), "w"),indent=4)
- return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement