def load_config(self, filename):
        """Loads config from a file."""
        self._filename = filename
        fileobj = open(filename, 'r')
        for lineno, line in enumerate(fileobj):
            line = line.strip()
            if not line:
                continue
            index = line.find('=')
            if index < 0:
                raise ValueError(
                    _('Error parsing line %d of config file %s') % (lineno,
                                                                    filename))
            key, value = line[:index].strip(), line[index+1:].strip()
            if key in self._dict:
                try:
                    self._dict[key] = eval(value)
                except Exception:  # pylint: disable=W0703
                    if (key == 'webilder.installation_date' and
                        value.startswith('time.struct_time')):
                        self._dict[key] = time.localtime()[:3]
                    else:
                        raise ValueError(_('Error parsing line %d of config'
                            ' file %s') % (lineno, filename))
            else:
                raise ValueError(
                    _('Unrecognized key in line %d of config file %s') % (
                      lineno, filename))
        fileobj.close()
dataset/ETHPy150Open thesamet/webilder/src/webilder/config.py/ConfigObject.load_config/original