Did I find the right examples for you? yes no

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Read config file.

        def read():
    """Read config file."""
    global config_color_options
    config = ConfigParser.RawConfigParser()
    if os.path.isfile(CONFIG_FILENAME):
        config.read(CONFIG_FILENAME)

    # add missing sections/options
    for section in CONFIG_DEFAULT_SECTIONS:
        if not config.has_section(section):
            config.add_section(section)
    for option in reversed(CONFIG_DEFAULT_OPTIONS):
        section, name = option[0].split('.', 1)
        if not config.has_option(section, name):
            config.set(section, name, option[1])
    section = 'color'
    for option in reversed(CONFIG_DEFAULT_COLOR_OPTIONS):
        if option[0] and not config.has_option(section, option[0]):
            config.set(section, option[0], option[1])

    # build list of color options
    config_color_options = []
    for option in CONFIG_DEFAULT_COLOR_OPTIONS:
        if option[0]:
            config_color_options.append(config.get('color', option[0]))
        else:
            config_color_options.append('#000000')

    return config
        


src/q/w/qweechat-HEAD/qweechat/qweechat.py   qweechat(Download)
    def __init__(self, *args):
        QTGUI.QMainWindow.__init__(*(self,) + args)
 
        self.config = config.read()