tRAII open of wallet file. - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 26c0b786e9c2c1996b22c68ccacae27fd0aaf27a DIR parent 3d836ebc385b1c9a3eca76b9d0d1a4165d68d46d HTML Author: Amir Taaki <genjix@riseup.net> Date: Fri, 24 Aug 2012 22:02:58 +0100 RAII open of wallet file. Diffstat: M lib/wallet.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -691,10 +691,9 @@ class Wallet: self.file_exists = False try: - f = open(self.path,"r") - data = f.read() - f.close() - except: + with open(self.path, "r") as f: + data = f.read() + except IOError: return try: d = ast.literal_eval( data ) #parse raw data from reading wallet file