[4.6.0] AttributeError('str' object has no attribute 'get_addresses')
Description
After upgrading to v4.6.0 RPC calls broken
/path/to/electrum stop
/path/to/electrum daemon -d
/path/to/electrum load_wallet -w /home/harry/.electrum/wallets/wallet_1
{
"id": "curltext",
"method": "listaddresses",
"params": {
"wallet": "/home/harry/.electrum/wallets/wallet_1",
"receiving": true,
"unused": true
}
}
response:
{
"id": "curltext",
"jsonrpc": "2.0",
"error": {
"code": 2,
"message": "internal error while executing RPC",
"data": {
"exception": "AttributeError(\"'str' object has no attribute 'get_addresses'\")",
"traceback": "Traceback (most recent call last):\n File \"/home/harry/cliapps/electrum/lib/python3.11/site-packages/electrum/daemon.py\", line 266, in handle\n response['result'] = await f(**params)\n ^^^^^^^^^^^^^^^^^\n File \"/home/harry/cliapps/electrum/lib/python3.11/site-packages/electrum/commands.py\", line 194, in func_wrapper\n return await func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/harry/cliapps/electrum/lib/python3.11/site-packages/electrum/commands.py\", line 1164, in listaddresses\n for addr in wallet.get_addresses():\n ^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'str' object has no attribute 'get_addresses'\n"
}
}
}
yes, this behavior changed between 4.5.8 and 4.6.0.
I proposed a fix in https://github.com/spesmilo/electrum/pull/10105 to make both wallet_path and wallet arguments work.
As a workaround you can just replace wallet with wallet_path and then your rpc call should work.
E.g.:
{
"id": "curltext",
"method": "listaddresses",
"params": {
"wallet_path": "/home/harry/.electrum/wallets/wallet_1",
"receiving": true,
"unused": true
}
}
I proposed a fix in https://github.com/spesmilo/electrum/pull/10105 to make both wallet_path and wallet arguments work.
why? I do not think that is desirable.
I made that change specifically in order to get rid of polymorphism of that parameter.
The consequence is that RPCs need to pass wallet_path instead of wallet.
That's a breaking change, but it is acceptable for a major release.
That's a breaking change, but it is acceptable for a major release.
Right. However we should at least add some better error-handling to better inform the user what's going on.
That's a breaking change, but it is acceptable for a major release.
Major release? That would mean bumping the first digit. Going from 4.5.8 → 4.6 is just a minor release under Semantic Versioning.
why? I do not think that is desirable. I made that change specifically in order to get rid of polymorphism of that parameter. The consequence is that RPCs need to pass wallet_path instead of wallet.
@ecdsa i wasn't aware this is a intentional change and considered it to be a regression. We can close #10105 if you prefer to keep the new api.