--- a/eric7/WebBrowser/PageScreenDialog.py Mon Jun 20 13:25:14 2022 +0200 +++ b/eric7/WebBrowser/PageScreenDialog.py Mon Jun 20 19:47:39 2022 +0200 @@ -9,7 +9,7 @@ import pathlib -from PyQt6.QtCore import pyqtSlot, Qt, QFile, QSize, QIODevice +from PyQt6.QtCore import pyqtSlot, Qt, QSize from PyQt6.QtGui import QImage, QPainter, QPixmap from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton @@ -87,24 +87,12 @@ if not res: return False - file = QFile(fileName) - if not file.open(QIODevice.OpenModeFlag.WriteOnly): - EricMessageBox.warning( - self, - self.tr("Save Page Screen"), - self.tr("Cannot write file '{0}:\n{1}.") - .format(fileName, file.errorString())) - return False - - res = self.__pagePixmap.save(file) - file.close() - + res = self.__pagePixmap.save(fileName) if not res: EricMessageBox.warning( self, self.tr("Save Page Screen"), - self.tr("Cannot write file '{0}:\n{1}.") - .format(fileName, file.errorString())) + self.tr("Cannot write file '{0}'.").format(fileName)) return False return True