From c8b7151cb1c93b4f2f30faf673be4360904e4be0 Mon Sep 17 00:00:00 2001 From: Artyom Syazantsev Date: Wed, 29 Oct 2008 19:09:17 +0200 Subject: [PATCH] Binary reading and writing for Win compatibility --- filecache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filecache.py b/filecache.py index 74b2cc0..dcb2433 100644 --- a/filecache.py +++ b/filecache.py @@ -21,7 +21,7 @@ class FileCache: """Cache get value by key""" path = self.__cache_file_path(key) if os.access(path, os.F_OK): - filep = open(path) + filep = open(path, 'rb') obj = pickle.load(filep) filep.close() if obj['expire_time'] == 0 or obj['expire_time'] > time.time(): @@ -37,7 +37,7 @@ class FileCache: obj = self.__create_cache_obj(value) if not os.access(os.path.dirname(path), os.F_OK): os.makedirs(os.path.dirname(path)) - filep = open(path, 'w') + filep = open(path, 'wb') pickle.dump(obj, filep) filep.close() def __create_cache_obj(self, obj): -- 2.11.4.GIT