From 21673c95f4b9546e115fa8a128b0c6bb8c74d4b0 Mon Sep 17 00:00:00 2001 From: Maran Date: Fri, 24 Apr 2015 13:14:17 +0200 Subject: [PATCH] Fix wallet write to support windows --- lib/wallet.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/wallet.py b/lib/wallet.py index d6e8fcd6..4ef50c72 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -135,15 +135,18 @@ class WalletStorage(object): def write(self): assert not threading.currentThread().isDaemon() + temp_path = self.path + '.tmp' s = json.dumps(self.data, indent=4, sort_keys=True) - with open(self.path + '.tmp', "w") as f: + with open(temp_path, "w") as f: f.write(s) - os.rename(self.path + '.tmp', self.path) + os.remove(self.path) + os.rename(temp_path, self.path) if 'ANDROID_DATA' not in os.environ: import stat os.chmod(self.path,stat.S_IREAD | stat.S_IWRITE) + class Abstract_Wallet(object): """ Wallet classes are created to handle various address generation methods.