--- a/eric6/eric6.py Wed Apr 14 19:38:19 2021 +0200 +++ b/eric6/eric6.py Wed Apr 14 19:59:16 2021 +0200 @@ -37,6 +37,7 @@ import time import logging import io +import contextlib try: from PyQt5.QtCore import qWarning, QLibraryInfo, QTimer, QCoreApplication @@ -51,10 +52,8 @@ " it is installed and accessible.") sys.exit(100) -try: +with contextlib.suppress(ImportError): from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__ -except ImportError: - pass # some global variables needed to start the application args = None @@ -201,12 +200,10 @@ sections = ['', separator, timeString, separator, errmsg, separator, tbinfo] msg = '\n'.join(sections) - try: - with open(logFile, "w", encoding="utf-8") as f: - f.write(msg) - f.write(versionInfo) - except OSError: - pass + with contextlib.suppress(OSError), \ + open(logFile, "w", encoding="utf-8") as f: + f.write(msg) + f.write(versionInfo) if inMainLoop is None: warning = notice + msg + versionInfo