def load(self, onError='raise'):
        try:
            d = {}
            with open(self.preffile, 'r') as in_f:
                buf = in_f.read()
            for line in buf.split('\n'):
                line = line.strip()
                # skip comments and anything that doesn't look like an
                # assignment
                if line.startswith('#') or (not ('=' in line)):
                    continue
                else:
                    try:
                        i = line.index('=')
                        key = line[:i].strip()
                        val = eval(line[i+1:].strip())
                        d[key] = val
                    except Exception as e:
                        # silently skip parse errors, for now
                        continue

            self.setDict(d)
        except Exception as e:
            errmsg = "Error opening settings file (%s): %s" % (
                self.preffile, str(e))
            if onError == 'silent':
                pass
            elif onError == 'warn':
                self.logger.warning(errmsg)
            else:
                raise SettingError(errmsg)
dataset/ETHPy150Open ejeschke/ginga/ginga/misc/Settings.py/SettingGroup.load/original