RAII open of wallet file.

This commit is contained in:
Amir Taaki 2012-08-24 22:02:58 +01:00
parent 3d836ebc38
commit 26c0b786e9
1 changed files with 3 additions and 4 deletions

View File

@ -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