electrum icon indicating copy to clipboard operation
electrum copied to clipboard

AttributeError: 'NoneType' object has no attribute 'get_password_for_storage_encryption'

Open TARS-bot opened this issue 1 year ago • 2 comments

Crash Report

This crash report was reported through the automatic crash reporting system 🤖

Traceback

Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/wizard/wizard.py", line 203, in on_next_button_clicked
    page.apply()
  File "/home/user/wspace/electrum/electrum/gui/qt/wizard/wallet.py", line 1258, in apply
    self.wizard_data['password'] = client.get_password_for_storage_encryption()
AttributeError: 'NoneType' object has no attribute 'get_password_for_storage_encryption'

AttributeError: 'NoneType' object has no attribute 'get_password_for_storage_encryption'

Reporter

This issue was reported by 7 user(s):

Electrum Version Python Version Operating System Wallet Type Locale Stack
4.5.2-12-ge7ebf5d95 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] Linux-6.5.0-15-generic-x86_64-with-glibc2.35 standard en_GB
4.5.5 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:20:04) [MSC v.1929 32 bit (Intel)] Windows-10-10.0.19045-SP0 standard ru_UA
4.5.8 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:20:04) [MSC v.1929 32 bit (Intel)] Windows-10-10.0.18363-SP0 standard,imported en_US
4.5.8 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:20:04) [MSC v.1929 32 bit (Intel)] Windows-10-10.0.18363-SP0 standard,imported en_US
4.5.8 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:20:04) [MSC v.1929 32 bit (Intel)] Windows-10-10.0.18363-SP0 standard,imported en_US
4.5.8 3.10.11 (v3.10.11:7d4cc5aa85, Apr 4 2023, 19:05:19) [Clang 13.0.0 (clang-1300.0.29.30)] macOS-15.3.2-x86_64-i386-64bit standard ?
4.5.8 3.10.11 (v3.10.11:7d4cc5aa85, Apr 4 2023, 19:05:19) [Clang 13.0.0 (clang-1300.0.29.30)] macOS-13.7.3-x86_64-i386-64bit standard ?

Additional Information

abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about amateur crowd cliff exercise urge rice crazy budget raccoon help that


TARS-bot avatar Jan 31 '24 04:01 TARS-bot

see steps to reproduce in https://github.com/spesmilo/electrum/commit/e7ebf5d950dcff8dd08b7ec5b1b66b68012609d7

Other similar trace when client still exists but the device was already disconnected:

Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/wizard/wizard.py", line 203, in on_next_button_clicked
    page.apply()
  File "/home/user/wspace/electrum/electrum/gui/qt/wizard/wallet.py", line 1258, in apply
    self.wizard_data['password'] = client.get_password_for_storage_encryption()
  File "/home/user/wspace/electrum/electrum/plugin.py", line 406, in wrapper
    return run_in_hwd_thread(partial(func, *args, **kwargs))
  File "/home/user/wspace/electrum/electrum/plugin.py", line 399, in run_in_hwd_thread
    return fut.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/user/wspace/electrum/electrum/plugins/hw_wallet/plugin.py", line 260, in get_password_for_storage_encryption
    xpub = self.get_xpub(derivation, "standard")
  File "/home/user/wspace/electrum/electrum/plugin.py", line 406, in wrapper
    return run_in_hwd_thread(partial(func, *args, **kwargs))
  File "/home/user/wspace/electrum/electrum/plugin.py", line 396, in run_in_hwd_thread
    return func()
  File "/home/user/wspace/electrum/electrum/plugins/trezor/clientbase.py", line 142, in get_xpub
    node = trezorlib.btc.get_public_node(self.client, address_n).node
  File "/home/user/.local/lib/python3.10/site-packages/trezorlib/tools.py", line 267, in wrapped_f
    ret = f(*args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/trezorlib/btc.py", line 127, in get_public_node
    return client.call(
  File "/home/user/.local/lib/python3.10/site-packages/trezorlib/tools.py", line 288, in wrapped_f
    client.open()
  File "/home/user/.local/lib/python3.10/site-packages/trezorlib/client.py", line 130, in open
    self.transport.begin_session()
  File "/home/user/.local/lib/python3.10/site-packages/trezorlib/transport/bridge.py", line 159, in begin_session
    data = self._call("acquire/" + self.device["path"])
  File "/home/user/.local/lib/python3.10/site-packages/trezorlib/transport/bridge.py", line 143, in _call
    return call_bridge(uri, data=data)
  File "/home/user/.local/lib/python3.10/site-packages/trezorlib/transport/bridge.py", line 52, in call_bridge
    raise BridgeException(path, r.status_code, r.json()["error"])
trezorlib.transport.bridge.BridgeException: trezord: acquire/1/null failed with code 400: device not found

@accumulator I am not quite sure how to do error-handling in apply(). I guess one approach would be to have another wizard component that we enter if the user clicks "Next" with the encrypt_cb checked...

SomberNight avatar Jan 31 '24 04:01 SomberNight

My first thought is to (let) raise in apply(), and try-except around page.apply() in on_next_button_clicked() (and probably a few other places), where we can set the error on the current wizard page, which shows the error text and should only allow prev to be pressed.

accumulator avatar Feb 05 '24 10:02 accumulator