--- a/eric6/Project/CreateDialogCodeDialog.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/Project/CreateDialogCodeDialog.py Thu Apr 15 18:11:24 2021 +0200 @@ -10,6 +10,7 @@ import sys import os import json +import contextlib from PyQt5.QtCore import ( pyqtSlot, Qt, QMetaObject, QRegularExpression, QSortFilterProxyModel, @@ -96,14 +97,12 @@ self.__initError = True return - try: + with contextlib.suppress(ImportError): splitExt = os.path.splitext(self.srcFile) exts = [splitExt[1]] if len(splitExt) == 2 else None from Utilities import ModuleParser self.__module = ModuleParser.readModule( self.srcFile, extensions=exts, caching=False) - except ImportError: - pass if self.__module is not None: self.filenameEdit.setText(self.srcFile)