--- a/eric6/QScintilla/MarkupProviders/ImageMarkupDialog.py Wed Apr 14 19:38:19 2021 +0200 +++ b/eric6/QScintilla/MarkupProviders/ImageMarkupDialog.py Wed Apr 14 19:59:16 2021 +0200 @@ -7,6 +7,8 @@ Module implementing a dialog to enter data for an image markup. """ +import contextlib + from PyQt5.QtCore import pyqtSlot, QSize from PyQt5.QtGui import QImage, QImageReader from PyQt5.QtWidgets import QDialog, QDialogButtonBox @@ -79,10 +81,8 @@ inputFormats = [] readFormats = QImageReader.supportedImageFormats() for readFormat in readFormats: - try: + with contextlib.suppress(KeyError): inputFormats.append(filters[bytes(readFormat).decode()]) - except KeyError: - pass inputFormats.sort() inputFormats.append(self.tr("All Files (*)")) if filters["png"] in inputFormats: