ttest if labels exist before loop. don't raise if a label cannot be converted - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 7e9153aaa44ea06604d5ad39a9009074d5dd795c DIR parent 5160f46ca1e9ab6236c9a77886587f502ec189b4 HTML Author: ThomasV <thomasv@gitorious> Date: Mon, 11 May 2015 11:55:26 +0200 ttest if labels exist before loop. don't raise if a label cannot be converted Diffstat: M lib/wallet.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -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: t@@ -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