From 2c37332d0c19a7b5410fcd46b88ac31463e68a42 Mon Sep 17 00:00:00 2001 From: QuintinoDuarte Date: Tue, 7 Jul 2015 15:08:19 +0100 Subject: [PATCH] Replaced os.rename for shutil.move for Windows users When using os.rename on Windows, if dst already exists, OSError will be raised even if it is a file. --- util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util.py b/util.py index b297e05..b88b61a 100644 --- a/util.py +++ b/util.py @@ -234,8 +234,8 @@ def saveObject(filename, object): h = open(filename + '.tmp', mode='wb') pickle.dump(object, h) h.close() - os.rename(filename + '.tmp', filename) - + import shutil + shutil.move(filename + '.tmp', filename) def loadObject(filename): '''load an object from a file'''