Better error when opening a non-wallet file
Also window modality fixes for __init__.py
This commit is contained in:
@@ -134,7 +134,7 @@ class ElectrumGui:
|
|||||||
try:
|
try:
|
||||||
storage = WalletStorage(filename)
|
storage = WalletStorage(filename)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
QMessageBox.information(None, _('Error'), str(e), _('OK'))
|
WindowModalDialog.warning(None, _('Error'), str(e))
|
||||||
return
|
return
|
||||||
if not storage.file_exists:
|
if not storage.file_exists:
|
||||||
recent = self.config.get('recently_open', [])
|
recent = self.config.get('recently_open', [])
|
||||||
@@ -147,7 +147,7 @@ class ElectrumGui:
|
|||||||
wallet = Wallet(storage)
|
wallet = Wallet(storage)
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
QMessageBox.warning(None, _('Warning'), str(e), _('OK'))
|
WindowModalDialog.warning(None, _('Warning'), str(e))
|
||||||
return
|
return
|
||||||
action = wallet.get_action()
|
action = wallet.get_action()
|
||||||
# run wizard
|
# run wizard
|
||||||
|
|||||||
@@ -69,11 +69,11 @@ class WalletStorage(PrintError):
|
|||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
d = ast.literal_eval(data) #parse raw data from reading wallet file
|
d = ast.literal_eval(data) #parse raw data from reading wallet file
|
||||||
|
labels = d.get('labels', {})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise IOError("Cannot read wallet file '%s'" % self.path)
|
raise IOError("Cannot read wallet file '%s'" % self.path)
|
||||||
self.data = {}
|
self.data = {}
|
||||||
# In old versions of Electrum labels were latin1 encoded, this fixes breakage.
|
# In old versions of Electrum labels were latin1 encoded, this fixes breakage.
|
||||||
labels = d.get('labels', {})
|
|
||||||
for i, label in labels.items():
|
for i, label in labels.items():
|
||||||
try:
|
try:
|
||||||
unicode(label)
|
unicode(label)
|
||||||
|
|||||||
Reference in New Issue
Block a user