diff py/params.py @ 148:b32e5a11a4cb

few updates, seems to run
author Matt Johnston <matt@ucc.asn.au>
date Sat, 15 Dec 2012 23:49:08 +0800
parents 6517ddee3187
children d03157c7ad60
line wrap: on
line diff
--- a/py/params.py	Sun Dec 09 20:07:15 2012 +0800
+++ b/py/params.py	Sat Dec 15 23:49:08 2012 +0800
@@ -2,6 +2,7 @@
 import collections
 import json
 import config
+from utils import W,L,E,EX
 
 _FIELD_DEFAULTS = {
     'fridge_setpoint': 16,
@@ -27,7 +28,11 @@
 
     def load(self, f = None):
         if not f:
-            f = file(config.PARAMS_FILE, 'r')
+            try:
+                f = file(config.PARAMS_FILE, 'r')
+            except IOError, e:
+                W("Missing parameter file, using defaults. %s", e)
+                return
         u = json.load(f)
         for k in u:
             if k not in self: