remove unnecessary references to old-style sfa.storage.record
[sface.git] / sface / sfidata.py
index 9a2710a..9209b1e 100644 (file)
@@ -1,3 +1,4 @@
+import json
 import os
 import pickle
 from PyQt4.QtCore import *
@@ -105,11 +106,21 @@ class SfiData:
         if not slice:
             slice = config.getSlice()
 
+        if not slice:
+            return None
+
         filename = config.fullpath(slice+".sliverstatus")
 
         if os.path.exists(filename):
             data = open(filename).read()
-            return pickle.loads(data)
+            try:
+                if hasattr(json, "loads"):
+                     return json.loads(data)   # python 2.6
+                else:
+                     return json.read(data)    # python 2.5
+            except:
+                print "Exception in getSliverStatus"
+                return None
 
         return None