--- a/eric6/QScintilla/Editor.py Sun Nov 01 11:17:06 2020 +0100 +++ b/eric6/QScintilla/Editor.py Sat Dec 05 12:29:26 2020 +0100 @@ -170,7 +170,7 @@ @param filetype type of the source file (string) @param editor reference to an Editor object, if this is a cloned view @param tv reference to the task viewer object - @exception IOError raised to indicate an issue accessing the file + @exception OSError raised to indicate an issue accessing the file """ super(Editor, self).__init__() self.setAttribute(Qt.WA_KeyCompression) @@ -373,7 +373,7 @@ QFileInfo(self.fileName).size() // 1024), icon=E5MessageBox.Warning) if not res: - raise IOError() + raise OSError() self.readFile(self.fileName, True) self.__bindLexer(self.fileName) self.__bindCompleter(self.fileName) @@ -3093,7 +3093,7 @@ fn, encoding) else: txt, self.encoding = Utilities.readEncodedFile(fn) - except (UnicodeDecodeError, IOError) as why: + except (UnicodeDecodeError, OSError) as why: E5MessageBox.critical( self.vm, self.tr('Open File'), @@ -3194,17 +3194,17 @@ try: permissions = os.stat(fn).st_mode perms_valid = True - except EnvironmentError: + except OSError: # if there was an error, ignore it perms_valid = False try: os.remove(bfn) - except EnvironmentError: + except OSError: # if there was an error, ignore it pass try: os.rename(fn, bfn) - except EnvironmentError: + except OSError: # if there was an error, ignore it pass @@ -3217,7 +3217,7 @@ if createBackup and perms_valid: os.chmod(fn, permissions) return True - except (IOError, Utilities.CodingError, UnicodeError) as why: + except (OSError, Utilities.CodingError, UnicodeError) as why: E5MessageBox.critical( self, self.tr('Save File'), @@ -6746,7 +6746,7 @@ try: with open(fname, "r", encoding="utf-8") as f: lines = f.readlines() - except IOError: + except OSError: E5MessageBox.critical( self, self.tr("Error loading macro"), @@ -6807,7 +6807,7 @@ with open(fname, "w", encoding="utf-8") as f: f.write("{0}{1}".format(name, "\n")) f.write(self.macros[name].save()) - except IOError: + except OSError: E5MessageBox.critical( self, self.tr("Error saving macro"), @@ -7192,7 +7192,7 @@ # reread the file try: self.readFile(self.fileName) - except IOError: + except OSError: # do not prompt for this change again... self.lastModified = QDateTime.currentDateTime() self.setModified(False)