From 8e234f3ccd43e49e907eb1ea47a772ecef6c6273 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 11 Apr 2022 17:37:10 +0200 Subject: [PATCH] qt gui: better detection of missing PyQt5 at startup If I use apt on ubuntu to install python3-pyqt5 and then remove it, it leaves an empty namespace: ``` $ python3 Python 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import PyQt5 >>> import PyQt5.QtGui Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'PyQt5.QtGui' >>> PyQt5 ``` --- electrum/gui/qt/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py index 894a4abac..bf4780b3a 100644 --- a/electrum/gui/qt/__init__.py +++ b/electrum/gui/qt/__init__.py @@ -33,6 +33,7 @@ from typing import Optional, TYPE_CHECKING, List try: import PyQt5 + import PyQt5.QtGui except Exception: sys.exit("Error: Could not import PyQt5 on Linux systems, you may try 'sudo apt-get install python3-pyqt5'")