commit 7e9153aaa44ea06604d5ad39a9009074d5dd795c
parent 5160f46ca1e9ab6236c9a77886587f502ec189b4
Author: ThomasV <thomasv@gitorious>
Date: Mon, 11 May 2015 11:55:26 +0200
test if labels exist before loop. don't raise if a label cannot be converted
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -73,7 +73,8 @@ class WalletStorage(object):
raise IOError("Cannot read wallet file '%s'" % self.path)
self.data = {}
# In old versions of Electrum labels were latin1 encoded, this fixes breakage.
- for i, label in d['labels'].items():
+ labels = d.get('labels', {})
+ for i, label in labels.items():
try:
unicode(label)
except UnicodeDecodeError:
@@ -83,7 +84,8 @@ class WalletStorage(object):
json.dumps(key)
json.dumps(value)
except:
- raise Exception('Failed to convert wallet to 2.x format')
+ print_error('Failed to convert label to json format', key)
+ continue
self.data[key] = value
self.file_exists = True