Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P2: Important
-
Resolution: Fixed
-
Affects Version/s: 5.15.2
-
Component/s: PySide
-
Labels:None
-
Environment:Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)]
-
Platform/s:
-
Commits:a97698f0a5 (pyside/tqtc-pyside-setup/5.15.5) 2641a665fb (pyside/tqtc-pyside-setup/5.15.5)
Description
I am converting a project from PyQt5 to Pyside2 and have come accross a section of code that crashes the python interpretter when it runs (but only ~60% of the time???). The code takes a rendered PDF page image from PyMuPDF, converts it to a QImage, then to a QPixmap for display with a QGraphicsPixmapItem. The crash appears to occur on the 'QPixmap.fromImage' method call.
import fitz from PySide2 import QtGui, QtWidgets fname = #Insert any PDF file path here pagenum = 3 if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) doc = fitz.open(fname) page = doc[pagenum] pix = page.get_pixmap() doc.close() qimage = QtGui.QImage(pix.samples, pix.width, pix.height, pix.stride, \ QtGui.QImage.Format_RGB888) qpix = QtGui.QPixmap.fromImage(qimage) qtgi = QtWidgets.QGraphicsPixmapItem(qpix)