Details
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)