Revert "Port obmc to python3.5"
Parse error with this change:
TypeError: iter() returned non-iterator of type 'PathTreeItemIterator'
This reverts commit f99783be6592130bbad2d0f69ada2b7ac61618f3.
Change-Id: Id2b7f4af5284d25d59e19905c7b873726b02f700
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/obmc/dbuslib/propertycacher.py b/obmc/dbuslib/propertycacher.py
index ebbe92a..7888b46 100644
--- a/obmc/dbuslib/propertycacher.py
+++ b/obmc/dbuslib/propertycacher.py
@@ -15,7 +15,7 @@
# permissions and limitations under the License.
import os
-import pickle
+import cPickle
import json
CACHE_PATH = '/var/cache/obmc/'
@@ -28,7 +28,7 @@
def save(obj_path, iface_name, properties):
- print("Caching: "+obj_path)
+ print "Caching: "+obj_path
filename = getCacheFilename(obj_path, iface_name)
parent = os.path.dirname(filename)
try:
@@ -39,11 +39,11 @@
## use json module to convert dbus datatypes
props = json.dumps(properties[iface_name])
prop_obj = json.loads(props)
- pickle.dump(prop_obj, output)
+ cPickle.dump(prop_obj, output)
except Exception as e:
- print("ERROR: "+str(e))
+ print "ERROR: "+str(e)
except:
- print("ERROR opening cache file: "+filename)
+ print "ERROR opening cache file: "+filename
def load(obj_path, iface_name, properties):
@@ -52,14 +52,14 @@
if (os.path.isfile(filename)):
if iface_name in properties:
properties[iface_name] = {}
- print("Loading from cache: "+filename)
+ print "Loading from cache: "+filename
try:
p = open(filename, 'rb')
- data = pickle.load(p)
- for prop in list(data.keys()):
+ data = cPickle.load(p)
+ for prop in data.keys():
properties[iface_name][prop] = data[prop]
except Exception as e:
- print("ERROR: Loading cache file: " + str(e))
+ print "ERROR: Loading cache file: " + str(e)
finally:
p.close()