From bf65d7bf6d6fdf9a3b8622d6db5bb5823e7c2469 Mon Sep 17 00:00:00 2001 From: daniel flood Date: Thu, 11 Feb 2021 15:23:00 +1100 Subject: [PATCH 1/2] safely get qt modules --- python/tank/util/qt_importer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/tank/util/qt_importer.py b/python/tank/util/qt_importer.py index 90785e0b65..fda4d2c0e2 100644 --- a/python/tank/util/qt_importer.py +++ b/python/tank/util/qt_importer.py @@ -55,35 +55,35 @@ def QtCore(self): """ :returns: QtCore module, if available. """ - return self._modules["QtCore"] if self._modules else None + return self._modules.get("QtCore") @property def QtGui(self): """ :returns: QtGui module, if available. """ - return self._modules["QtGui"] if self._modules else None + return self._modules.get("QtGui") @property def QtWebKit(self): """ :returns: QtWebKit module, if available. """ - return self._modules["QtWebKit"] if self._modules else None + return self._modules.get("QtWebKit") @property def QtNetwork(self): """ :returns: QtNetwork module, if available. """ - return self._modules["QtNetwork"] if self._modules else None + return self._modules.get("QtNetwork") @property def QtWebEngineWidgets(self): """ :returns: QtWebEngineWidgets module, if available. """ - return self._modules["QtWebEngineWidgets"] if self._modules else None + return self._modules.get("QtWebEngineWidgets") @property def binding(self): From 7fb2b0393be070e72174324b37d4e78a1154f98c Mon Sep 17 00:00:00 2001 From: daniel flood Date: Thu, 18 Feb 2021 14:17:58 +1100 Subject: [PATCH 2/2] added a contructor check to ensure qt modules memeber is an empty dict and not None --- python/tank/util/qt_importer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/tank/util/qt_importer.py b/python/tank/util/qt_importer.py index fda4d2c0e2..0284f02e8e 100644 --- a/python/tank/util/qt_importer.py +++ b/python/tank/util/qt_importer.py @@ -50,6 +50,8 @@ def __init__(self, interface_version_requested=QT4): self._qt_version_tuple, ) = self._import_modules(interface_version_requested) + self._modules = self._modules or {} + @property def QtCore(self): """