From 1d47ff5f4d6adc9b718017754a160fc591b16c4b Mon Sep 17 00:00:00 2001 From: Hugo Date: Tue, 7 Jun 2016 16:17:20 +0300 Subject: [PATCH 1/2] Fix for program importing PyQt4 when PyQt5 also installed Fixes https://github.com/python-pillow/Pillow/issues/1939 using suggested solution. --- PIL/ImageQt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PIL/ImageQt.py b/PIL/ImageQt.py index aece9d62a3d..422638c6f5e 100644 --- a/PIL/ImageQt.py +++ b/PIL/ImageQt.py @@ -26,7 +26,7 @@ from PyQt5.QtGui import QImage, qRgba, QPixmap from PyQt5.QtCore import QBuffer, QIODevice qt_version = '5' -except ImportError: +except (ImportError, RuntimeError): try: from PyQt4.QtGui import QImage, qRgba, QPixmap from PyQt4.QtCore import QBuffer, QIODevice From 1ab30d0ba5a820ff57893aaddba6a7a4d49b882d Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 22 Jun 2016 11:25:59 +0300 Subject: [PATCH 2/2] Catch RuntimeError when importing Qt4 In case PySide is already imported --- PIL/ImageQt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PIL/ImageQt.py b/PIL/ImageQt.py index 422638c6f5e..4eb3654026d 100644 --- a/PIL/ImageQt.py +++ b/PIL/ImageQt.py @@ -31,7 +31,7 @@ from PyQt4.QtGui import QImage, qRgba, QPixmap from PyQt4.QtCore import QBuffer, QIODevice qt_version = '4' - except ImportError: + except (ImportError, RuntimeError): try: from PySide.QtGui import QImage, qRgba, QPixmap from PySide.QtCore import QBuffer, QIODevice