(self, config_file)
return presets
Read config file.
Read config file.
Read config file .
def _read_config_file(self, config_file):
        """Read config file."""
        try:
            config = configparser.RawConfigParser(allow_no_value=True)
            # use utf_8_sig to ignore a BOM if it's at the start of the file
            # (e.g. created by Notepad)
            with io.open(config_file, 'r', encoding='utf_8_sig', errors='replace') as f:
                if PY2:
                    config.readfp(WhitespaceStripper(f))
                else:
                    config.read_file(WhitespaceStripper(f))
        except (configparser.Error, IOError):
            logging.warning(
                u'Error in configuration file `%s`. Configuration not loaded.', config_file
            )
            return {u'pcbasic': {}}
        presets = {header: dict(config.items(header)) for header in config.sections()}
        return presets
def _read_config_file ( self , config_file ) : try : config = configparser . RawConfigParser ( allow_no_value = True ) # use utf_8_sig to ignore a BOM if it's at the start of the file # (e.g. created by Notepad) with io . open ( config_file , 'r' , encoding = 'utf_8_sig' , errors = 'replace' ) as f : if PY2 : config . readfp ( WhitespaceStripper ( f ) ) else : config . read_file ( WhitespaceStripper ( f ) ) except ( configparser . Error , IOError ) : logging . warning ( u'Error in configuration file `%s`. Configuration not loaded.' , config_file ) return { u'pcbasic' : { } } presets = { header : dict ( config . items ( header ) ) for header in config . sections ( ) } return presets