- def __init__(self, filepath = "/etc/sfa/sfa_config"):
- # Load plc_config
-
- loaded = False
- # path to config.py source - this would be '/usr/share/geniwrapper/geni/util'
- path = os.path.dirname(os.path.abspath(__file__))
- # parent directory of config.py source
- self.basepath = os.path.dirname(path)
- # path to actual config file
- filename = os.path.basename(filepath)
- alt_file = os.path.join(path, 'util', filename)
- files = [filepath, alt_file]
-
- for config_file in files:
- try:
- execfile(config_file, self.__dict__)
- loaded = True
- self.config_file = config_file
- self.config_path = os.path.dirname(config_file)
- break
- except:
- pass
+ def __init__(self, config_file = "/etc/sfa/sfa_config"):
+ self.config_file = None
+ self.config_path = None
+ self.load(config_file)