handled case where there is no config file
This commit is contained in:
parent
50cc783b97
commit
fda2246c14
@ -20,13 +20,14 @@ default_config = {
|
|||||||
'pypath': None,
|
'pypath': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
with open(os.path.expanduser('~/.config/interp.json')) as config_file:
|
try:
|
||||||
d = json.load(config_file)
|
with open(os.path.expanduser('~/.config/interp.json')) as config_file:
|
||||||
|
d = json.load(config_file)
|
||||||
|
except IOError as e:
|
||||||
|
d = {}
|
||||||
|
|
||||||
config = dict(default_config.items() + d.items())
|
config = dict(default_config.items() + d.items())
|
||||||
|
|
||||||
print config
|
|
||||||
|
|
||||||
logger = logging.getLogger('interp')
|
logger = logging.getLogger('interp')
|
||||||
logger.setLevel(LEVELS[config['level']])
|
logger.setLevel(LEVELS[config['level']])
|
||||||
my_format = logging.Formatter('%(asctime)s %(levelname)s (%(process)d) %(filename)s %(funcName)s:%(lineno)d %(message)s')
|
my_format = logging.Formatter('%(asctime)s %(levelname)s (%(process)d) %(filename)s %(funcName)s:%(lineno)d %(message)s')
|
||||||
|
Loading…
Reference in New Issue
Block a user