aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-08-06 14:13:36 +0200
committerChristian Tismer <tismer@stackless.com>2020-08-07 11:46:40 +0200
commit4457db11f873b29bd46c268126cbbdea6b397eee (patch)
treef370e25be76b9d9c7487f0548e5ec4ecb940a693
parent96345e5684d825ac75bc2d63f0491f5d19f4d5c6 (diff)
shiboken: warn if the signature module fails to initialize
There are setup errors that fail to initialize the signature module correctly. This is for instance possible if packaging puts the shiboken2 module somewhere into the path, but the binary cannot be reached, because shiboken2 also exists as a dictionary. Task-number: PYSIDE-1352 Change-Id: I679d6855c87093b946cfbaeb063c10d45b00c8ad Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/pyside2/PySide2/__init__.py.in16
1 files changed, 15 insertions, 1 deletions
diff --git a/sources/pyside2/PySide2/__init__.py.in b/sources/pyside2/PySide2/__init__.py.in
index f860c6ac9..5c33c57a0 100644
--- a/sources/pyside2/PySide2/__init__.py.in
+++ b/sources/pyside2/PySide2/__init__.py.in
@@ -1,6 +1,7 @@
from __future__ import print_function
import os
import sys
+from textwrap import dedent
__all__ = list("Qt" + body for body in
"@all_module_shortnames@"
@@ -62,7 +63,20 @@ def _setupQtDirectories():
raise
# Trigger signature initialization.
- type.__signature__
+ try:
+ type.__signature__
+ except AttributeError:
+ print(dedent('''\
+ {stars}
+ PySide2/__init__.py: The `signature` module was not initialized.
+ This libshiboken module was loaded from
+
+ "{shiboken2.__file__}".
+
+ Please make sure that this is the real shiboken2 binary and not just a folder.
+ {stars}
+ ''').format(stars=79*"*", **locals()), file=sys.stderr)
+ raise
if sys.platform == 'win32':
# PATH has to contain the package directory, otherwise plugins