open cache files in binary mode for pickle
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Fri, 1 Apr 2016 10:08:05 +0000 (12:08 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Fri, 1 Apr 2016 10:08:05 +0000 (12:08 +0200)
sfa/util/cache.py

index 38eccc9..75b22e4 100644 (file)
@@ -108,9 +108,9 @@ class Cache:
         return self.__str()    
 
     def save_to_file(self, filename):
-        f = open(filename, 'w')
+        f = open(filename, 'wb')
         pickle.dump(self.cache, f)
 
     def load_from_file(self, filename):
-        f = open(filename, 'r')
+        f = open(filename, 'rb')
         self.cache = pickle.load(f)