pysilcam/config.py
def load_config(filename):
    '''Load config file and validate content
    
    Args:
      filename (str) : filename including path

    Raises:
      RuntimeError : when file could not be read

    Returns:
      ConfigParser  : with the file parsed

    '''
    #Check that the file exists
    if not os.path.exists(filename):
        raise RuntimeError('Config file not found: {0}'.format(filename))
    
    ##Create ConfigParser and populate from file
    conf = configparser.ConfigParser()
    files_parsed = conf.read(filename)
    if filename not in files_parsed:
        raise RuntimeError('Could not parse config file {0}'.format(filename))

    #Check that we got the correction version
    fileversion = int(conf['General']['version'])
    expectversion = __configversion__
    if fileversion != expectversion:
        errmsg = 'Wrong configuration file version, expected {0}, got {1}.'
        raise RuntimeError(errmsg.format(fileversion, expectversion))

    return conf
Load config file and validate content
    
    Args:
      filename (str) : filename including path

    Raises:
      RuntimeError : when file could not be read

    Returns:
      ConfigParser  : with the file parsed

    
Load config file and validate content
Load config file and validate content
def load_config(filename):
    if not os.path.exists(filename):
        raise RuntimeError('Config file not found: {0}'.format(filename))
    conf = configparser.ConfigParser()
    files_parsed = conf.read(filename)
    if filename not in files_parsed:
        raise RuntimeError('Could not parse config file {0}'.format(filename))
    fileversion = int(conf['General']['version'])
    expectversion = __configversion__
    if fileversion != expectversion:
        errmsg = 'Wrong configuration file version, expected {0}, got {1}.'
        raise RuntimeError(errmsg.format(fileversion, expectversion))
    return conf
def load_config ( filename ) : if not os . path . exists ( filename ) : raise RuntimeError ( 'Config file not found: {0}' . format ( filename ) ) conf = configparser . ConfigParser ( ) files_parsed = conf . read ( filename ) if filename not in files_parsed : raise RuntimeError ( 'Could not parse config file {0}' . format ( filename ) ) fileversion = int ( conf [ 'General' ] [ 'version' ] ) expectversion = __configversion__ if fileversion != expectversion : errmsg = 'Wrong configuration file version, expected {0}, got {1}.' raise RuntimeError ( errmsg . format ( fileversion , expectversion ) ) return conf
Load config file and validate content
Load config file and validate content
'''Load config file and validate content
    
    Args:
      filename (str) : filename including path

    Raises:
      RuntimeError : when file could not be read

    Returns:
      ConfigParser  : with the file parsed

    ''' #Check that the file exists ##Create ConfigParser and populate from file #Check that we got the correction version
ConfigParser  : with the file parsed
ConfigParser : with the file parsed
when file could not be read
when file could not be read
RuntimeError 
filename
filename including path
filename including path