If the error is not handled, the running daemon will continuously
print the following error message:
```
Traceback (most recent call last):
File "lbry/extras/daemon/exchange_rate_manager.py", line 77, in get_rate
File "lbry/extras/daemon/exchange_rate_manager.py", line 189, in get_rate_from_response
KeyError: 0
```
This started happening when the UPBit exchange decided to delist
the LBC coin.
Normally `json_response` should be a dictionary, not a list,
so `json_response[0]` causes an error.
By checking for the `'error'` key, we can raise the proper exception.
Once this is done, the message will be a warning, not a traceback.
```
WARNING lbry.extras.daemon.exchange_rate_manager:92:
Failed to get exchange rate from UPbit: result not found
```
Remove the first space in the block of code as it is not necessary.
This
```
$ python --version
```
Becomes this
```
$ python --version
```
Also break the big block of code into individual blocks.
Because of issue #2769 at the moment the `lbrynet` daemon
will only work correctly with Python 3.7.
The `deadsnakes` personal package archive (PPA) provides
Python 3.7 for Ubuntu distributions that no longer have it
in their official repositories like 18.04 and 20.04.
If Python 3.8+ is used, the daemon will start but the RPC server
may not accept messages, returning the following:
```
Could not connect to daemon. Are you sure it's running?
```
Leave with `deactivate`.
Enter the environment again with
```
source lbry-venv/bin/activate
```
When developing, we can start the server interactively.
```
python lbry/extras/cli.py start
```
Parameters can be passed in the same way.
```
python lbry/extras/cli.py wallet balance
```
If a Python debugger (`pdb` or `ipdb`) is installed we can also start
it in this way, set up break points, and step through the code.
```
ipdb lbry/extras/cli.py
```
Currently `lbrynet blob get <hash>` does not work to download
single blobs which are not already present in the system.
The function locks up and never returns.
It only works for blobs that are in the `blobfiles` directory
already.
This bug is reported in lbryio/lbry-sdk, issue #2070.
Maybe this script can be investigated, and certain parts
can be added to `lbry.extras.daemon.daemon.jsonrpc_blob_get`
in order to solve the previous issue, and finally download
single blobs from the network (peers or reflector servers).
This is nothing special, it just allows the module
to run without throwing an error on the import.
From
```
from lbry.wallet.client.basenetwork import ClientSession
```
To
```
from lbry.wallet.network import ClientSession
```
This is nothing special, it just allows the module
to run without throwing an error on the import.
From
```
from lbry.wallet.client.basenetwork import ClientSession
```
To
```
from lbry.wallet.network import ClientSession
```
This is nothing special, it just allows the module
to run without throwing an error.
From
```
from lbry.wallet.server.db import SQLDB
```
To
```
from lbry.wallet.server.db.writer import SQLDB
```