previously, if GUI-related imports raised, the GUI would not start
but the process would not exit (e.g. asyncio event loop would go on)
Traceback (most recent call last):
File "...\electrum\electrum\daemon.py", line 517, in run_gui
gui = __import__('electrum.gui.' + gui_name, fromlist=['electrum'])
File "...\electrum\electrum\gui\qt\__init__.py", line 39, in <module>
from PyQt5.QtGui import QGuiApplication
ImportError: DLL load failed while importing QtGui: The specified module could not be found.
Load DLLs from inner 'electrum' dir instead of '.dlls'.
To make it consistent with where we expect libsecp256k1 (.dll/.so) be.
(note that while in case of libsecp we specifically already search the main dir,
without this change, other DLLs such as libusb or libzbar would not be found there)
Python 3.8 changed where DLLs are searched for.
see https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew
This potentially affect our binaries when we start shipping python 3.8+, however that is not being addressed here. This commit simply addresses the usecase of running from source, on Windows, using python 3.8.
On older Python, a user could build/obtain DLLs and place them anywhere on the system %PATH%, however this no longer works with py3.8, as %PATH% is no longer checked.
With py3.8, instead, we now check if there is a folder named '.dlls' in the top-level project directory, and if so, register that as an additional search path.
A user who wants to run Electrum from source on Windows using python 3.8 or later, with their custom DLLs, should manually create the '.dlls' folder and put their DLLs there. If they also want to switch between e.g. python 3.7 and 3.8, they should also include '.dlls' in the system %PATH%.
When using Electrum, interesting DLLs include at least libsecp256k1.dll, libusb-1.0.dll, libzbar-0.dll.
The few other cases that used SimpleConfig.get_instance() now
either get passed a config instance, or they try to get a reference
to something else that has a reference to a config.
(see lnsweep, qt/qrcodewidget, qt/qrtextedit)
e.g. when interacting with hw wallets (e.g. signmessage)
it does not make sense to time out
also, str(e) of some exceptions such as TimeoutError is ""...
- commands are async
- the asyncio loop is started and stopped from the main script
- the daemon's main loop runs in the main thread
- use jsonrpcserver and jsonrpcclient instead of jsonrpclib
old style "-v" still works
filtering examples:
-v=debug,network=error,interface=error // effectively blacklists network and interface
-v=warning,network=debug,interface=debug // effectively whitelists network and interface
After the introduction of arguments for -v, it would sometimes incorrectly consume the CLI cmd as its argument.
This change keeps the old "-v" syntax working, at the cost of having to provide the arguments without a whitespace directly after -v (and the args need to be single letters).