Skip to content

Commit 8a8953b

Browse files
authored
Merge pull request #350 from blurstudio/import_error_warning_improvement
Include the module name that failed to import in warning
2 parents 6ea602a + defede1 commit 8a8953b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Qt.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import json
4646

4747

48-
__version__ = "1.3.1"
48+
__version__ = "1.3.2"
4949

5050
# Enable support for `from Qt import *`
5151
__all__ = []
@@ -1259,11 +1259,11 @@ def _setup(module, extras):
12591259

12601260
Qt.__binding__ = module.__name__
12611261

1262-
def _warn_import_error(exc):
1262+
def _warn_import_error(exc, module):
12631263
msg = str(exc)
12641264
if "No module named" in msg:
12651265
return
1266-
_warn("ImportError: %s" % msg)
1266+
_warn("ImportError(%s): %s" % (module, msg))
12671267

12681268
for name in list(_common_members) + extras:
12691269
try:
@@ -1275,8 +1275,8 @@ def _warn_import_error(exc):
12751275
# children of the binding.
12761276
submodule = __import__(name)
12771277
except ImportError as e2:
1278-
_warn_import_error(e)
1279-
_warn_import_error(e2)
1278+
_warn_import_error(e, name)
1279+
_warn_import_error(e2, name)
12801280
continue
12811281

12821282
setattr(Qt, "_" + name, submodule)

0 commit comments

Comments
 (0)