PYQT-4错误:QPainter :: begin:Paint设备返回引擎== 0,Type = 3

时间:2014-05-14 21:23:04

标签: python python-2.7 python-3.x pyqt pyqt4

我有一个奇怪的问题。我有一些pyqt-4代码设置来绘制和捕获指定网址的图像。这是代码:

def save_page(webpage, output):
    global error
    global AWSError
    # Set the size of the (virtual) browser window
    webpage.setViewportSize(webpage.mainFrame().contentsSize())
    # Paint this frame into an image
    image = QImage(webpage.viewportSize(), QImage.Format_ARGB32)
    painter = QPainter(image)
    webpage.mainFrame().render(painter)
    painter.setOpacity(opacity)
    painter.setPen(QtCore.Qt.blue)
    painter.setFont(QtGui.QFont('arial', 15))
    painter.drawText(image.rect(), QtCore.Qt.AlignVertical_Mask | QtCore.Qt.AlignRight , WaterMarktxt + ' ' + str(now.strftime(" %d. %B %Y %I:%M%p")))
    painter.end()

    image.save(ImageDestinationPath + "/" + output + ".png")

现在我为applciation指定了多个url并且它们处理得非常好但是当我处理http://www.google.com(它重定向到https)时出现错误。这是堆栈。请注意图片ID = 0000..1适用于Google,图片ID = 0000 ..适用于所有其他网址。

Processing SourceImageId: 000000001
QPainter::begin: Paint device returned engine == 0, type: 3
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setBrush: Painter not active
QPainter::pen: Painter not active
QPainter::setPen: Painter not active
QPainter::setOpacity: Painter not active
QPainter::setPen: Painter not active
QPainter::setFont: Painter not active
QPainter::end: Painter not active, aborted
[Errno 2] No such file or directory: './SourceImagePath/000000001.png'
True :results
url still left to be painted.
QFont::setPixelSize: Pixel size <= 0 (0)
called onLoadFinished
***********************************************************

Response from the webpage : True
Processing SourceImageId: 000000000
000000000.png image successfully saved to S3
sourceimage id: 000000000 name of the file: 000000000.png error: None
000000000.png image removed from local folder
True :results
QWaitCondition: Destroyed while threads are still waiting

正如您所看到的,它无法为谷歌形成图像,而对于几乎所有其他网址都成功。任何具体原因?它与我指定的图像容量或图像大小有关吗?

0 个答案:

没有答案