diff -r 3257703e10c5 -r 9978016560ec eric6/eric6_api.py --- a/eric6/eric6_api.py Tue Oct 13 19:02:26 2020 +0200 +++ b/eric6/eric6_api.py Wed Oct 14 17:50:39 2020 +0200 @@ -296,18 +296,18 @@ if outdir and not os.path.exists(outdir): os.makedirs(outdir) try: - out = open(outputFile, "w", encoding="utf-8", newline=newline) - out.write("\n".join(sorted(apis)) + "\n") - out.close() + with open(outputFile, "w", encoding="utf-8", + newline=newline) as out: + out.write("\n".join(sorted(apis)) + "\n") except IOError as v: sys.stderr.write("{0} error: {1}\n".format(outputFile, v[1])) sys.exit(3) try: - out = open(basesFile, "w", encoding="utf-8", newline=newline) - for baseEntry in sorted(basesDict.keys()): - out.write("{0} {1}\n".format( - baseEntry, " ".join(sorted(basesDict[baseEntry])))) - out.close() + with open(basesFile, "w", encoding="utf-8", + newline=newline) as out: + for baseEntry in sorted(basesDict.keys()): + out.write("{0} {1}\n".format( + baseEntry, " ".join(sorted(basesDict[baseEntry])))) except IOError as v: sys.stderr.write("{0} error: {1}\n".format(basesFile, v[1])) sys.exit(3)