diff -r 59a9a658618c -r 93b8a353c4bf eric6/PipInterface/PipPackagesWidget.py --- a/eric6/PipInterface/PipPackagesWidget.py Wed Apr 14 19:38:19 2021 +0200 +++ b/eric6/PipInterface/PipPackagesWidget.py Wed Apr 14 19:59:16 2021 +0200 @@ -10,6 +10,7 @@ import textwrap import os import html.parser +import contextlib from PyQt5.QtCore import pyqtSlot, Qt, QUrl, QUrlQuery from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest @@ -1213,12 +1214,8 @@ return if not os.path.exists(cfgFile): - try: - with open(cfgFile, "w") as f: - f.write("[global]\n") - except OSError: - # ignore these - pass + with contextlib.suppress(OSError), open(cfgFile, "w") as f: + f.write("[global]\n") # check, if the destination is writeable if not os.access(cfgFile, os.W_OK):