Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added additional debugging output to pyface/qt/__init__.py. #1230

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pyface/qt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@

# if we have no preference, is a Qt API available? Or fail with ImportError.
if qt_api is None:
msg = "Nothing found in sys.modules or os.environ.\n"
msg += "Attempting to import...\n"
for api_name, module in QtAPIs:
try:
importlib.import_module(module)
msg += f"Successfully imported {module}\n"
importlib.import_module(".QtCore", module)
qt_api = api_name
break
except ImportError:
except ImportError as err:
msg += f"Failed to import {err.name}; problem involved: {err.path}.\n"
continue
else:
raise ImportError("Cannot import any of " + ", ".join(modules))
raise ImportError(msg + "Cannot import any of " + ", ".join(modules))

# otherwise check QT_API value is valid
elif qt_api not in api_names:
Expand Down
Loading