Browse Source

check for existence instead of catching error

pull/7/head
Pēteris Caune 10 years ago
parent
commit
ca352cfccb
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      hc/settings.py

+ 4
- 3
hc/settings.py View File

@ -17,10 +17,11 @@ import warnings
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 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()) env = json.loads(open(p).read())
except FileNotFoundError:
else:
warnings.warn("~/.hc.json does not exist, using defaults") warnings.warn("~/.hc.json does not exist, using defaults")
env = {} env = {}


Loading…
Cancel
Save