From 641bceb88058875fe93f61aaa30593df0747145c Mon Sep 17 00:00:00 2001 From: Josh Roesslein Date: Tue, 15 Sep 2009 23:52:37 -0500 Subject: [PATCH] Fixes for File Cache on windows. --- tweepy/cache.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tweepy/cache.py b/tweepy/cache.py index 1a39399..205d760 100644 --- a/tweepy/cache.py +++ b/tweepy/cache.py @@ -181,7 +181,8 @@ class FileCache(Cache): def _delete_file(self, path): os.remove(path) - os.remove(path + '.lock') + if os.path.exists(path + '.lock'): + os.remove(path + '.lock') def store(self, key, value): path = self._get_path(key) @@ -207,9 +208,6 @@ class FileCache(Cache): while self.lock: # acquire lock and open f_lock = self._lock_file(path, False) - if f_lock is None: - # does not exist - return None datafile = open(path, 'rb') # read pickled object @@ -224,7 +222,7 @@ class FileCache(Cache): self._delete_file(path) # unlock and return result - f_lock.close() + self._unlock_file(f_lock) return value def count(self): -- 2.25.1