--- a/eric6/QScintilla/Editor.py Wed Apr 14 19:38:19 2021 +0200 +++ b/eric6/QScintilla/Editor.py Wed Apr 14 19:59:16 2021 +0200 @@ -10,6 +10,7 @@ import os import re import difflib +import contextlib from PyQt5.QtCore import ( pyqtSignal, pyqtSlot, Qt, QDir, QTimer, QModelIndex, QFileInfo, @@ -3250,16 +3251,10 @@ except OSError: # if there was an error, ignore it perms_valid = False - try: + with contextlib.suppress(OSError): os.remove(bfn) - except OSError: - # if there was an error, ignore it - pass - try: + with contextlib.suppress(OSError): os.rename(fn, bfn) - except OSError: - # if there was an error, ignore it - pass # now write text to the file fn try: