From fda2246c14378d236623281aae6ee0f1fa0ca8ea Mon Sep 17 00:00:00 2001 From: Stephen Mardson McQuay Date: Wed, 23 Mar 2011 11:51:54 -0600 Subject: [PATCH] handled case where there is no config file --- interp/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/interp/__init__.py b/interp/__init__.py index 5af7710..d84f582 100644 --- a/interp/__init__.py +++ b/interp/__init__.py @@ -20,13 +20,14 @@ default_config = { 'pypath': None, } -with open(os.path.expanduser('~/.config/interp.json')) as config_file: - d = json.load(config_file) +try: + 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()) -print config - logger = logging.getLogger('interp') logger.setLevel(LEVELS[config['level']]) my_format = logging.Formatter('%(asctime)s %(levelname)s (%(process)d) %(filename)s %(funcName)s:%(lineno)d %(message)s')