electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 26c0b786e9c2c1996b22c68ccacae27fd0aaf27a
parent 3d836ebc385b1c9a3eca76b9d0d1a4165d68d46d
Author: Amir Taaki <genjix@riseup.net>
Date:   Fri, 24 Aug 2012 22:02:58 +0100

RAII open of wallet file.

Diffstat:
Mlib/wallet.py | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/wallet.py b/lib/wallet.py @@ -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