From ca352cfccbe562a50ca7d76314f368816add8da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 29 Jun 2015 20:33:15 +0300 Subject: [PATCH] check for existence instead of catching error --- hc/settings.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hc/settings.py b/hc/settings.py index 0e048a32..ab8fed33 100644 --- a/hc/settings.py +++ b/hc/settings.py @@ -17,10 +17,11 @@ import warnings BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -try: - p = os.path.expanduser("~/.hc.json") + +p = os.path.expanduser("~/.hc.json") +if os.path.exists(p): env = json.loads(open(p).read()) -except FileNotFoundError: +else: warnings.warn("~/.hc.json does not exist, using defaults") env = {}