Did I find the right examples for you? yes no

All Samples(9)  |  Call(3)  |  Derive(0)  |  Import(6)
Method provides way to read a config file and return a dictionary of
config keys and its values
@param config_file: Filesystem path of the config file. Defaults to
/etc/agentredrabbit.conf

        def ReadConfig(config_file="/etc/agentredrabbit.conf"):
    """
    Method provides way to read a config file and return a dictionary of
    config keys and its values
    @param config_file: Filesystem path of the config file. Defaults to
    /etc/agentredrabbit.conf
    """
    global config_fields
    config = ConfigParser()
    section = "agentredrabbit"
    if os.path.exists(config_file):
        try:
            with open(config_file, 'r') as cfg:
                config.readfp(cfg)
        except IOError, e:
            log.error("Error: config_file not found " + str(e))
    else:
        config.add_section(section)
        for key in config_fields.keys():
            config.set(section, key, config_fields[key])
        try:
            with open(config_file, 'w') as cfg:
                config.write(cfg)
        except IOError:
            pass

    cfg = {}
    for key in config_fields.keys():
        try:
            cfg[key] = config.get(section, key)
        except Exception:
            cfg[key] = config_fields[key]
    return cfg
        


src/a/g/agentredrabbit-HEAD/agentredrabbit/agentredrabbit.py   agentredrabbit(Download)
    from __init__ import __version__
 
    from config import ReadConfig
    from utils import log_format
    from transport import Transporter
    if options.config_file is not None:
        cfg_path = options.config_file
    config = ReadConfig(cfg_path)
 
    # Setup logger