Did I find the right examples for you? yes no

All Samples(28)  |  Call(17)  |  Derive(0)  |  Import(11)

        def read_config(get_attr, set_attr, config_file):
    global config_fields, config_dir
    if not os.path.exists(config_dir):
        os.makedirs(config_dir)

    config_options = reduce(lambda x, y: x + y, map(lambda x:
                            config_fields[x].keys(), config_fields.keys()))

    if os.path.exists(config_file):
        config = ConfigParser()
        try:
            with open(config_file, 'r') as cfg:
                config.readfp(cfg)
        except IOError, e:
            print "Error: config_file not found", e
    else:
        config = write_config(get_attr, config_file, True)
        print "Welcome! Using `set` configure the necessary settings:"
        print " ".join(sorted(config_options))
        print "Config file:", config_file
        print "After setting up, run the `sync` command to sync apis\n"

    missing_keys = []
    for section in config_fields.keys():
        for key in config_fields[section].keys():
            try:
                set_attr(key, config.get(section, key))
            except Exception:
                missing_keys.append(key)

    if len(missing_keys) > 0:
        print "Please fix `%s` in %s" % (', '.join(missing_keys), config_file)
        sys.exit()

    return config_options
        


src/r/a/ramona-1.1b1/ramona/console/cnsapp.py   ramona(Download)
import sys, os, socket, errno, logging, time, json, inspect
from ..config import config, read_config, config_files
from ..utils import launch_server_daemonized
from .. import cnscom, socketuri
from .parser import argparser
 
		try:
			read_config(configuration, use_env=False)
		except Exception, e:
			print("{0}".format(e))

src/r/a/ramona-HEAD/ramona/console/cnsapp.py   ramona(Download)
import sys, os, socket, errno, logging, time, json, inspect
from ..config import config, read_config, config_files
from ..utils import launch_server_daemonized
from .. import cnscom, socketuri
from .parser import argparser
 
		try:
			read_config(configuration, use_env=False)
		except Exception, e:
			print("{0}".format(e))

src/c/l/cloudmonkey-5.0.0/cloudmonkey/cloudmonkey.py   cloudmonkey(Download)
    from cachemaker import loadcache, savecache, monkeycache, splitverbsubject
    from config import __version__, __description__, __projecturl__
    from config import read_config, write_config, config_file
    from optparse import OptionParser
    from prettytable import PrettyTable
    def __init__(self, pname, cfile):
        self.program_name = pname
        self.config_file = cfile
        self.config_options = read_config(self.get_attr, self.set_attr,
                                          self.config_file)

src/g/o/Google2Piwik-HEAD/google2piwik.py   Google2Piwik(Download)
 
    if options.print_table_id:
        config.read_config(options.config_file)
        fetcher = GoogleFeedFetcher("")
        fetcher.PrintTableIDs()
        exit()
 
    if options.clear_archives:
        try:
            config.read_config(options.config_file)
        print "Checking configuration file:",
        try:
            config.read_config(options.config_file)
            print "[OK]"
        except:
            print "[FAILED], site with idsite = %s wasn't found" % config.ID_SITE
    else:
        config.read_config(options.config_file)
        if not (options.start_date or config.CONFIG_START):
            print "Start date parameter is required. For more info type ./google2piwik.py -h"

src/g/o/Google2Piwik-HEAD/google2piwikgui.py   Google2Piwik(Download)
    # Load settings if .conf file exists
    try:
        config.read_config(CONF_FILE)
    except:
        config.MYSQL_CREDENTIALS = {"host":"","port":"3306","user":"","passwd":"",

src/c/e/certmaster-HEAD/certmaster/certmaster.py   certmaster(Download)
import logger
 
from config import read_config
from commonconfig import CMConfig
 
    def __init__(self, conf_file=CERTMASTER_CONFIG):
        self.cfg = read_config(conf_file, CMConfig)
 
        usename = utils.get_hostname(talk_to_certmaster=False)
 
 
 
    config = read_config(CERTMASTER_CONFIG, CMConfig)
    listen_addr = config.listen_addr
    listen_port = config.listen_port

src/c/e/certmaster-HEAD/certmaster/logger.py   certmaster(Download)
 
import logging
from config import read_config
from commonconfig import CMConfig
 
    def __init__(self, logfilepath ="/var/log/certmaster/certmaster.log"):
        config_file = '/etc/certmaster/minion.conf'
        self.config = read_config(config_file, CMConfig)
        self.loglevel = logging._levelNames[self.config.log_level]
        self._setup_logging()

src/c/e/certmaster-HEAD/certmaster/utils.py   certmaster(Download)
import codes
import certs
from config import read_config
from commonconfig import MinionConfig
import logger
    # FIXME: paths should not be hard coded here, move to settings universally
    config_file = '/etc/certmaster/minion.conf'
    config = read_config(config_file, MinionConfig)
    cert_dir = config.cert_dir
    master_uri = 'http://%s:%s/' % (config.certmaster, config.certmaster_port)

src/r/a/ramona-1.1b1/ramona/server/svrapp.py   ramona(Download)
import sys, os, socket, signal, errno, weakref, logging, argparse, itertools, time, json
import pyev
from .. import cnscom, socketuri, version as ramona_version
from ..config import config, read_config, config_files, config_includes, get_numeric_loglevel, get_logconfig
from ..cnscom import program_state_enum, svrcall_error
 
		# Read configuration
		read_config()
 
		# Configure logging

src/r/a/ramona-HEAD/ramona/server/svrapp.py   ramona(Download)
import sys, os, socket, signal, errno, weakref, logging, argparse, itertools, time, json
import pyev
from .. import cnscom, socketuri, version as ramona_version
from ..config import config, read_config, config_files, config_includes, get_numeric_loglevel, get_logconfig
from ..cnscom import program_state_enum, svrcall_error
 
		# Read configuration
		read_config()
 
		# Configure logging

  1 | 2  Next