Skip to content

Commit

Permalink
Fix pyqt6 loader on windows (#1797)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchiodo authored Jan 7, 2025
1 parent cc85ca8 commit 7597262
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions src/debugpy/_vendored/pydevd/pydev_ipython/qt_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,25 +145,28 @@ def has_binding(api):
return True

except ModuleNotFoundError:
from importlib import machinery

# importing top level PyQt4/PySide module is ok...
mod = __import__(module_name)

# ...importing submodules is not
loader_details = (machinery.ExtensionFileLoader, machinery.EXTENSION_SUFFIXES)
submod_finder = machinery.FileFinder(mod.__path__[0], loader_details)
submod_check = (
submod_finder.find_spec("QtCore") is not None
and submod_finder.find_spec("QtGui") is not None
and submod_finder.find_spec("QtSvg") is not None
)
try:
from importlib import machinery

# importing top level PyQt4/PySide module is ok...
mod = __import__(module_name)

# ...importing submodules is not
loader_details = (machinery.ExtensionFileLoader, machinery.EXTENSION_SUFFIXES)
submod_finder = machinery.FileFinder(mod.__path__[0], loader_details)
submod_check = (
submod_finder.find_spec("QtCore") is not None
and submod_finder.find_spec("QtGui") is not None
and submod_finder.find_spec("QtSvg") is not None
)

# we can also safely check PySide version
if api == QT_API_PYSIDE:
return check_version(mod.__version__, '1.0.3') and submod_check
else:
return submod_check
# we can also safely check PySide version
if api == QT_API_PYSIDE:
return check_version(mod.__version__, '1.0.3') and submod_check
else:
return submod_check
except:
return False

except ImportError:
return False
Expand Down

0 comments on commit 7597262

Please sign in to comment.