--- a/eric6/PipInterface/PipPackagesWidget.py Tue Oct 13 19:02:26 2020 +0200 +++ b/eric6/PipInterface/PipPackagesWidget.py Wed Oct 14 17:50:39 2020 +0200 @@ -1147,9 +1147,8 @@ if not os.path.exists(cfgFile): try: - f = open(cfgFile, "w") - f.write("[global]\n") - f.close() + with open(cfgFile, "w") as f: + f.write("[global]\n") except (IOError, OSError): # ignore these pass