Skip to content

Commit

Permalink
Added additional debugging output to pyface/qt/__init__.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
capn-freako committed Mar 29, 2023
1 parent bd21b61 commit 732047f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyface/qt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,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

0 comments on commit 732047f

Please sign in to comment.