Sun, 22 Nov 2020 16:04:59 +0100
Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
--- a/eric6/CondaInterface/CondaExportDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/CondaInterface/CondaExportDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -185,7 +185,7 @@ try: with open(fileName, "w") as f: f.write(self.requirementsEdit.toPlainText()) - except (OSError, IOError) as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Generate Requirements"),
--- a/eric6/Cooperation/ChatWidget.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Cooperation/ChatWidget.py Sun Nov 22 16:04:59 2020 +0100 @@ -575,7 +575,7 @@ try: with open(fname, "w", encoding="utf-8") as f: f.write(txt) - except IOError as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Error saving Chat"),
--- a/eric6/DataViews/CodeMetrics.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/DataViews/CodeMetrics.py Sun Nov 22 16:04:59 2020 +0100 @@ -204,7 +204,7 @@ """ try: text = Utilities.readEncodedFile(filename)[0] - except (UnicodeError, IOError): + except (UnicodeError, OSError): return SourceStat() parser = Parser()
--- a/eric6/DataViews/PyCoverageDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/DataViews/PyCoverageDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -384,7 +384,7 @@ for file in files: try: os.remove(file) - except EnvironmentError: + except OSError: pass @pyqtSlot()
--- a/eric6/DataViews/PyProfileDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/DataViews/PyProfileDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -242,7 +242,7 @@ try: with open(fname, 'rb') as f: self.stats = pickle.load(f) # secok - except (EnvironmentError, pickle.PickleError, EOFError): + except (OSError, pickle.PickleError, EOFError): E5MessageBox.critical( self, self.tr("Loading Profiling Data"),
--- a/eric6/DebugClients/Python/AsyncFile.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/DebugClients/Python/AsyncFile.py Sun Nov 22 16:04:59 2020 +0100 @@ -65,14 +65,14 @@ Private method to check the mode. This method checks, if an operation is permitted according to - the mode of the file. If it is not, an IOError is raised. + the mode of the file. If it is not, an OSError is raised. @param mode the mode to be checked @type string - @exception IOError raised to indicate a bad file descriptor + @exception OSError raised to indicate a bad file descriptor """ if mode != self.mode: - raise IOError((9, '[Errno 9] Bad file descriptor')) + raise OSError((9, '[Errno 9] Bad file descriptor')) def pendingWrite(self): """ @@ -112,7 +112,7 @@ pass self.sock.sendall(buf) self.nWriteErrors = 0 - except socket.error: + except OSError: self.nWriteErrors += 1 if self.nWriteErrors > self.maxtries: self.wpending = [] # delete all output @@ -135,7 +135,7 @@ """ try: return self.sock.fileno() - except socket.error: + except OSError: return -1 def readable(self): @@ -294,19 +294,19 @@ @type int @param whence position the offset relates to @type int - @exception IOError This method is not supported and always raises an - IOError. + @exception OSError This method is not supported and always raises an + OSError. """ - raise IOError((29, '[Errno 29] Illegal seek')) + raise OSError((29, '[Errno 29] Illegal seek')) def tell(self): """ Public method to get the filepointer position. - @exception IOError This method is not supported and always raises an - IOError. + @exception OSError This method is not supported and always raises an + OSError. """ - raise IOError((29, '[Errno 29] Illegal seek')) + raise OSError((29, '[Errno 29] Illegal seek')) def truncate(self, size=-1): """ @@ -314,10 +314,10 @@ @param size size to truncate to @type int - @exception IOError This method is not supported and always raises an - IOError. + @exception OSError This method is not supported and always raises an + OSError. """ - raise IOError((29, '[Errno 29] Illegal seek')) + raise OSError((29, '[Errno 29] Illegal seek')) def writable(self): """
--- a/eric6/DebugClients/Python/DebugClientBase.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/DebugClients/Python/DebugClientBase.py Sun Nov 22 16:04:59 2020 +0100 @@ -224,7 +224,7 @@ # read the first and second line text = f.readline() text = "{0}{1}".format(text, f.readline()) - except IOError: + except OSError: self.__coding = default return @@ -1169,7 +1169,7 @@ try: rrdy, wrdy, xrdy = select.select([self.readstream], wrdy, []) - except (select.error, KeyboardInterrupt, socket.error): + except (KeyboardInterrupt, OSError): selectErrors += 1 if selectErrors <= 10: # arbitrarily selected # just carry on @@ -1212,7 +1212,7 @@ # immediate return if nothing is ready. try: rrdy, wrdy, xrdy = select.select([self.readstream], wrdy, [], 0) - except (select.error, KeyboardInterrupt, socket.error): + except (KeyboardInterrupt, OSError): return if self.readstream in rrdy:
--- a/eric6/DebugClients/Python/PyProfile.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/DebugClients/Python/PyProfile.py Sun Nov 22 16:04:59 2020 +0100 @@ -56,7 +56,7 @@ timings = marshal.load(cache) # secok if isinstance(timings, dict): self.timings = timings - except (EnvironmentError, EOFError, ValueError, TypeError): + except (OSError, EOFError, ValueError, TypeError): pass def save(self): @@ -67,7 +67,7 @@ try: with open(self.timingCache, 'wb') as cache: marshal.dump(self.timings, cache) - except EnvironmentError: + except OSError: pass # dump the profile data @@ -83,7 +83,7 @@ try: with open(file, 'wb') as f: pickle.dump(self.stats, f, 4) - except (EnvironmentError, pickle.PickleError): + except (OSError, pickle.PickleError): pass def erase(self):
--- a/eric6/Debugger/CallStackViewer.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Debugger/CallStackViewer.py Sun Nov 22 16:04:59 2020 +0100 @@ -184,7 +184,7 @@ f.write("{0}\n".format(itm.text(0))) f.write(78 * "=" + "\n") itm = self.itemBelow(itm) - except IOError as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Error saving Call Stack Info"),
--- a/eric6/Debugger/CallTraceViewer.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Debugger/CallTraceViewer.py Sun Nov 22 16:04:59 2020 +0100 @@ -178,7 +178,7 @@ call, itm.text(1), itm.text(2))) itm = self.callTrace.itemBelow(itm) - except IOError as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Error saving Call Trace Info"),
--- a/eric6/Debugger/DebugUI.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Debugger/DebugUI.py Sun Nov 22 16:04:59 2020 +0100 @@ -1163,7 +1163,7 @@ pass if "__IGNORE_EXCEPTION__" in lineFlags: res = E5MessageBox.No - except (UnicodeError, IOError): + except (UnicodeError, OSError): pass if res != E5MessageBox.No: self.viewmanager.setFileLine(
--- a/eric6/DocumentationTools/IndexGenerator.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/DocumentationTools/IndexGenerator.py Sun Nov 22 16:04:59 2020 +0100 @@ -207,7 +207,7 @@ if basename: package = package.replace(basename, "") out = self.__writeIndex(package, element, newline) - except IOError as v: + except OSError as v: sys.stderr.write("{0} error: {1}\n".format(package, v[1])) else: if out:
--- a/eric6/E5Gui/E5MainWindow.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/E5Gui/E5MainWindow.py Sun Nov 22 16:04:59 2020 +0100 @@ -50,7 +50,7 @@ try: with open(styleSheetFile, "r", encoding="utf-8") as f: styleSheet = f.read() - except (IOError, OSError) as msg: + except OSError as msg: E5MessageBox.warning( self, QCoreApplication.translate(
--- a/eric6/Graphics/UMLDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Graphics/UMLDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -256,7 +256,7 @@ try: with open(filename, "w", encoding="utf-8") as f: f.write("\n".join(lines)) - except (IOError, OSError) as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Save Diagram"), @@ -285,7 +285,7 @@ try: with open(filename, "r", encoding="utf-8") as f: data = f.read() - except (IOError, OSError) as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Load Diagram"),
--- a/eric6/MicroPython/MicroPythonCommandsInterface.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/MicroPython/MicroPythonCommandsInterface.py Sun Nov 22 16:04:59 2020 +0100 @@ -289,7 +289,7 @@ @type str @return tuple containg the directory listing @rtype tuple of str - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ if self.__repl.isMicrobit(): # BBC micro:bit does not support directories @@ -306,7 +306,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) return ast.literal_eval(out.decode("utf-8")) def lls(self, dirname="", fullstat=False, showHidden=False): @@ -325,7 +325,7 @@ false) or the complete stat() tuple. 'None' is returned in case the directory doesn't exist. @rtype tuple of (str, tuple) - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ if self.__repl.isMicrobit(): # BBC micro:bit does not support directories @@ -383,7 +383,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) fileslist = ast.literal_eval(out.decode("utf-8")) if fileslist is None: return None @@ -399,7 +399,7 @@ @param dirname directory to change to @type str - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ if dirname: commands = [ @@ -409,7 +409,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) def pwd(self): """ @@ -417,7 +417,7 @@ @return current directory @rtype str - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ if self.__repl.isMicrobit(): # BBC micro:bit does not support directories @@ -430,7 +430,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) return out.decode("utf-8").strip() def rm(self, filename): @@ -439,7 +439,7 @@ @param filename name of the file to be removed @type str - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ if filename: commands = [ @@ -449,7 +449,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) def rmrf(self, name, recursive=False, force=False): """ @@ -463,7 +463,7 @@ @type bool @return flag indicating success @rtype bool - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ if name: commands = [ @@ -496,7 +496,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) return ast.literal_eval(out.decode("utf-8")) return False @@ -507,7 +507,7 @@ @param dirname name of the directory to create @type str - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ if dirname: commands = [ @@ -517,7 +517,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) def rmdir(self, dirname): """ @@ -525,7 +525,7 @@ @param dirname name of the directory to be removed @type str - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ if dirname: commands = [ @@ -535,7 +535,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) def put(self, hostFileName, deviceFileName=None): """ @@ -547,10 +547,10 @@ @type str @return flag indicating success @rtype bool - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ if not os.path.isfile(hostFileName): - raise IOError("No such file: {0}".format(hostFileName)) + raise OSError("No such file: {0}".format(hostFileName)) with open(hostFileName, "rb") as hostFile: content = hostFile.read() @@ -576,7 +576,7 @@ out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) return True def get(self, deviceFileName, hostFileName=None): @@ -589,7 +589,7 @@ @type str @return flag indicating success @rtype bool - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ if not hostFileName: hostFileName = deviceFileName @@ -622,7 +622,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) # write the received bytes to the local file # convert eol to "\n" @@ -640,7 +640,7 @@ @return tuple of tuples containing the file system name, the total size, the used size and the free size @rtype tuple of tuples of (str, int, int, int) - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ commands = [ "import os as __os_", @@ -663,7 +663,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) infolist = ast.literal_eval(out.decode("utf-8")) if infolist is None: return None @@ -688,7 +688,7 @@ @return dictionary containing the version information @rtype dict - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ commands = [ "import os as __os_", @@ -697,7 +697,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) rawOutput = out.decode("utf-8").strip() rawOutput = rawOutput[1:-1] @@ -715,7 +715,7 @@ @return dictionary containing the implementation information @rtype dict - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ commands = [ "import sys as __sys_", @@ -738,7 +738,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) return ast.literal_eval(out.decode("utf-8")) def syncTime(self): @@ -746,7 +746,7 @@ Public method to set the time of the connected device to the local computer's time. - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ now = time.localtime(time.time()) commands = [ @@ -795,7 +795,7 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) def getTime(self): """ @@ -803,7 +803,7 @@ @return time of the device @rtype str - @exception IOError raised to indicate an issue with the device + @exception OSError raised to indicate an issue with the device """ commands = [ "import time as __time_", @@ -822,5 +822,5 @@ ] out, err = self.execute(commands) if err: - raise IOError(self.__shortError(err)) + raise OSError(self.__shortError(err)) return out.decode("utf-8").strip()
--- a/eric6/MicroPython/MicroPythonFileManagerWidget.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/MicroPython/MicroPythonFileManagerWidget.py Sun Nov 22 16:04:59 2020 +0100 @@ -661,7 +661,7 @@ os.mkdir(dirPath) self.__listLocalFiles(cwdWidget.text(), localDevice=localDevice) - except (OSError, IOError) as exc: + except OSError as exc: E5MessageBox.critical( self, self.tr("Create Directory"), @@ -737,7 +737,7 @@ os.remove(filename) self.__listLocalFiles(cwdWidget.text(), localDevice=localDevice) - except (OSError, IOError) as exc: + except OSError as exc: E5MessageBox.critical( self, self.tr("Delete File"),
--- a/eric6/MicroPython/MicroPythonGraphWidget.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/MicroPython/MicroPythonGraphWidget.py Sun Nov 22 16:04:59 2020 +0100 @@ -323,7 +323,7 @@ self.__dirty = False return True - except (IOError, OSError) as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Save Chart Data"),
--- a/eric6/Network/IRC/IrcChannelWidget.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Network/IRC/IrcChannelWidget.py Sun Nov 22 16:04:59 2020 +0100 @@ -1400,7 +1400,7 @@ txt = self.messages.toPlainText() with open(fname, "w", encoding="utf-8") as f: f.write(txt) - except IOError as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Error saving Messages"),
--- a/eric6/Network/IRC/IrcNetworkWidget.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Network/IRC/IrcNetworkWidget.py Sun Nov 22 16:04:59 2020 +0100 @@ -454,7 +454,7 @@ txt = self.messages.toPlainText() with open(fname, "w", encoding="utf-8") as f: f.write(txt) - except IOError as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Error saving Messages"),
--- a/eric6/PipInterface/Pip.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/PipInterface/Pip.py Sun Nov 22 16:04:59 2020 +0100 @@ -460,7 +460,7 @@ try: with open(requirements, "r") as f: reqs = f.read().splitlines() - except (OSError, IOError): + except OSError: return from UI.DeleteFilesConfirmationDialog import (
--- a/eric6/PipInterface/PipFreezeDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/PipInterface/PipFreezeDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -198,7 +198,7 @@ try: with open(fileName, "w") as f: f.write(self.requirementsEdit.toPlainText()) - except (OSError, IOError) as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Generate Requirements"),
--- a/eric6/PipInterface/PipPackagesWidget.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/PipInterface/PipPackagesWidget.py Sun Nov 22 16:04:59 2020 +0100 @@ -1157,7 +1157,7 @@ try: with open(cfgFile, "w") as f: f.write("[global]\n") - except (IOError, OSError): + except OSError: # ignore these pass
--- a/eric6/PluginManager/PluginInstallDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/PluginManager/PluginInstallDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -483,7 +483,7 @@ "Error installing plugin. Reason: {0}").format(str(why)), False ) - except IOError as why: + except OSError as why: self.__rollback() return ( False, @@ -600,7 +600,7 @@ os.remove(fnamec) os.remove(pluginFile) - except (IOError, OSError, os.error): + except (OSError, os.error): # ignore some exceptions pass
--- a/eric6/PluginManager/PluginManager.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/PluginManager/PluginManager.py Sun Nov 22 16:04:59 2020 +0100 @@ -208,7 +208,7 @@ try: with open(fname, "w"): pass - except IOError: + except OSError: return ( False, self.tr("Could not create a package for {0}.") @@ -221,7 +221,7 @@ try: with open(fname, "w"): pass - except IOError: + except OSError: del self.pluginDirs["user"] if ( @@ -1203,13 +1203,13 @@ if not os.path.exists(downloadDir): try: os.mkdir(downloadDir, 0o755) - except (OSError, IOError): + except OSError: # try again with (possibly) new default downloadDir = self.__defaultDownloadDir if not os.path.exists(downloadDir): try: os.mkdir(downloadDir, 0o755) - except (OSError, IOError) as err: + except OSError as err: E5MessageBox.critical( self.__ui, self.tr("Plugin Manager Error"),
--- a/eric6/PluginManager/PluginRepositoryDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/PluginManager/PluginRepositoryDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -998,7 +998,7 @@ for removeFile in removeFiles: try: os.remove(os.path.join(downloadPath, removeFile)) - except (IOError, OSError) as err: + except OSError as err: if not quiet: E5MessageBox.critical( None, @@ -1027,7 +1027,7 @@ for removeFile in removeFiles: try: os.remove(os.path.join(downloadPath, removeFile)) - except (IOError, OSError) as err: + except OSError as err: if not quiet: E5MessageBox.critical( None,
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -795,7 +795,7 @@ source, encoding = Utilities.readEncodedFile( self.filename) source = source.splitlines(True) - except (UnicodeError, IOError) as msg: + except (UnicodeError, OSError) as msg: self.results = CodeStyleCheckerDialog.hasResults self.__createFileErrorItem(self.filename, str(msg)) self.progress += 1 @@ -843,7 +843,7 @@ source, encoding = Utilities.readEncodedFile( filename) source = source.splitlines(True) - except (UnicodeError, IOError) as msg: + except (UnicodeError, OSError) as msg: self.results = CodeStyleCheckerDialog.hasResults self.__createFileErrorItem(filename, str(msg)) continue
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Sun Nov 22 16:04:59 2020 +0100 @@ -211,12 +211,12 @@ bfn = '{0}~'.format(self.__filename) try: os.remove(bfn) - except EnvironmentError: + except OSError: # if there was an error, ignore it pass try: os.rename(self.__filename, bfn) - except EnvironmentError: + except OSError: # if there was an error, ignore it pass @@ -229,7 +229,7 @@ with open(self.__filename, "wb") as fp: fp.write(txt) - except (IOError, UnicodeError) as err: + except (OSError, UnicodeError) as err: # Could not save the file! Skipping it. Reason: {0} return ("FIXWRITE_ERROR", [str(err)])
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/eradicate.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/eradicate.py Sun Nov 22 16:04:59 2020 +0100 @@ -227,5 +227,5 @@ else: try: fix_file(name, args=args, standard_out=standard_out) - except IOError as exception: + except OSError as exception: print('{}'.format(exception), file=standard_error)
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/pycodestyle.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/pycodestyle.py Sun Nov 22 16:04:59 2020 +0100 @@ -1998,7 +1998,7 @@ elif lines is None: try: self.lines = readlines(filename) - except IOError: + except OSError: (exc_type, exc) = sys.exc_info()[:2] self._io_error = '%s: %s' % (exc_type.__name__, exc) self.lines = []
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/translations.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/translations.py Sun Nov 22 16:04:59 2020 +0100 @@ -471,9 +471,9 @@ "E742": ["l"], "E743": ["l"], "E901": ["SyntaxError", "Invalid Syntax"], - "E902": ["IOError"], + "E902": ["OSError"], - "FIXWRITE_ERROR": ["IOError"], + "FIXWRITE_ERROR": ["OSError"], } messageCatalogs = (
--- a/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -248,7 +248,7 @@ try: self.source = Utilities.readEncodedFile(self.filename)[0] self.source = Utilities.normalizeCode(self.source) - except (UnicodeError, IOError) as msg: + except (UnicodeError, OSError) as msg: self.noResults = False self.__createResultItem( self.filename, 1, 0, @@ -282,7 +282,7 @@ try: source = Utilities.readEncodedFile(filename)[0] source = Utilities.normalizeCode(source) - except (UnicodeError, IOError) as msg: + except (UnicodeError, OSError) as msg: self.noResults = False self.__createResultItem( self.filename, 1, 0, @@ -354,7 +354,7 @@ source = Utilities.readEncodedFile(fn)[0] source = Utilities.normalizeCode(source) source = source.splitlines() - except (UnicodeError, IOError): + except (UnicodeError, OSError): source = "" else: source = self.source.splitlines()
--- a/eric6/Plugins/PluginWizardEricPlugin.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/PluginWizardEricPlugin.py Sun Nov 22 16:04:59 2020 +0100 @@ -168,7 +168,7 @@ try: with open(packageFile, "w", encoding="utf-8"): pass - except IOError as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Create Package"),
--- a/eric6/Plugins/VcsPlugins/vcsGit/ConfigurationPage/GitPage.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/ConfigurationPage/GitPage.py Sun Nov 22 16:04:59 2020 +0100 @@ -98,7 +98,7 @@ f.write("[user]\n") f.write(" name = {0} {1}\n".format(firstName, lastName)) f.write(" email = {0}\n".format(email)) - except (IOError, OSError): + except OSError: # ignore these pass editor = MiniEditor(cfgFile, "Properties", self)
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -343,7 +343,7 @@ with open(fname, "w", encoding="utf-8", newline="") as f: f.write(eol.join(self.contents2.toPlainText().splitlines())) f.write(eol) - except IOError as why: + except OSError as why: E5MessageBox.critical( self, self.tr('Save Diff'), self.tr(
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -2308,7 +2308,7 @@ with open(fname, "w", encoding="utf-8", newline="") as f: f.write(eol.join(self.diffEdit.toPlainText().splitlines())) f.write(eol) - except IOError as why: + except OSError as why: E5MessageBox.critical( self, self.tr('Save Diff'), self.tr(
--- a/eric6/Plugins/VcsPlugins/vcsGit/git.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsGit/git.py Sun Nov 22 16:04:59 2020 +0100 @@ -1404,7 +1404,7 @@ ignore.write("\n".join(ignorePatterns)) ignore.write("\n") status = True - except IOError: + except OSError: status = False if status and autoAdd: @@ -1630,7 +1630,7 @@ output2 = f1.read() f1.close() name2 = "{0} (Work)".format(name) - except IOError: + except OSError: E5MessageBox.critical( self.__ui, self.tr("Git Side-by-Side Difference"), @@ -2664,7 +2664,7 @@ try: with open(fname, "w") as f: f.write(output) - except (OSError, IOError) as err: + except OSError as err: E5MessageBox.critical( self.__ui, self.tr("Create Bisect Replay File"), @@ -3579,7 +3579,7 @@ try: with open(cfgFile, "w"): pass - except IOError: + except OSError: pass self.repoEditor = MiniEditor(cfgFile, "Properties") self.repoEditor.show() @@ -3603,7 +3603,7 @@ f.write("[user]\n") f.write(" name = {0} {1}\n".format(firstName, lastName)) f.write(" email = {0}\n".format(email)) - except (IOError, OSError): + except OSError: # ignore these pass self.userEditor = MiniEditor(cfgFile, "Properties")
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -241,7 +241,7 @@ try: with open(fname, "w", encoding="utf-8", newline="") as f: f.write(eol.join(self.contents.toPlainText().splitlines())) - except IOError as why: + except OSError as why: E5MessageBox.critical( self, self.tr('Save Diff'), self.tr(
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -2669,7 +2669,7 @@ try: with open(fname, "w", encoding="utf-8", newline="") as f: f.write(eol.join(self.diffEdit.toPlainText().splitlines())) - except IOError as why: + except OSError as why: E5MessageBox.critical( self, self.tr('Save Diff'), self.tr(
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditCommitEditor.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditCommitEditor.py Sun Nov 22 16:04:59 2020 +0100 @@ -51,7 +51,7 @@ try: with open(self.__fileName, "r") as f: txt = f.read() - except (IOError, OSError) as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Edit Commit Message"), @@ -90,7 +90,7 @@ try: with open(self.__fileName, "w") as f: f.write(msg) - except (IOError, OSError) as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Edit Commit Message"),
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditPlanEditor.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditPlanEditor.py Sun Nov 22 16:04:59 2020 +0100 @@ -105,7 +105,7 @@ try: with open(self.__fileName, "r") as f: txt = f.read() - except (IOError, OSError) as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Edit Plan"), @@ -240,7 +240,7 @@ try: with open(self.__fileName, "w") as f: f.write(text) - except (IOError, OSError) as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Edit Plan"),
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/hg.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/hg.py Sun Nov 22 16:04:59 2020 +0100 @@ -1713,7 +1713,7 @@ with open(name, "r", encoding="utf-8") as f1: output2 = f1.read() name2 = "{0} (Work)".format(name) - except IOError: + except OSError: E5MessageBox.critical( self.__ui, self.tr("Mercurial Side-by-Side Difference"), @@ -2163,7 +2163,7 @@ "\n ".join(lfPattern))) self.__monitorRepoIniFile(repodir) self.__iniFileChanged(cfgFile) - except IOError: + except OSError: pass self.repoEditor = MiniEditor(cfgFile, "Properties") self.repoEditor.show() @@ -2329,7 +2329,7 @@ ignore.write("\n".join(ignorePatterns)) ignore.write("\n") status = True - except IOError: + except OSError: status = False if status and autoAdd: @@ -3063,7 +3063,7 @@ try: with open(hgsub, "r") as f: contents = f.readlines() - except IOError as err: + except OSError as err: E5MessageBox.critical( self.__ui, self.tr("Add Sub-repository"), @@ -3091,7 +3091,7 @@ try: with open(hgsub, "w") as f: f.writelines(contents) - except IOError as err: + except OSError as err: E5MessageBox.critical( self.__ui, self.tr("Add Sub-repository"), @@ -3123,7 +3123,7 @@ try: with open(hgsub, "r") as f: subrepositories = [line.strip() for line in f.readlines()] - except IOError as err: + except OSError as err: E5MessageBox.critical( self.__ui, self.tr("Remove Sub-repositories"), @@ -3142,7 +3142,7 @@ try: with open(hgsub, "w") as f: f.write(contents) - except IOError as err: + except OSError as err: E5MessageBox.critical( self.__ui, self.tr("Remove Sub-repositories"),
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -435,7 +435,7 @@ try: with open(fname, "w", encoding="utf-8", newline="") as f: f.write(eol.join(self.contents.toPlainText().splitlines())) - except IOError as why: + except OSError as why: E5MessageBox.critical( self, self.tr('Save Diff'), self.tr(
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnUtilities.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnUtilities.py Sun Nov 22 16:04:59 2020 +0100 @@ -80,7 +80,7 @@ try: with open(config, "w") as f: f.write(DefaultConfig) - except IOError: + except OSError: pass @@ -92,7 +92,7 @@ try: with open(config, "r") as f: configList = f.read().splitlines() - except IOError: + except OSError: return newConfig = [] @@ -129,5 +129,5 @@ try: with open(config, "w") as f: f.write("\n".join(newConfig)) - except IOError: + except OSError: pass
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py Sun Nov 22 16:04:59 2020 +0100 @@ -2199,7 +2199,7 @@ with open(name, "r", encoding="utf-8") as f1: output2 = f1.read() name2 = name - except IOError: + except OSError: E5MessageBox.critical( self.__ui, self.tr("Subversion Side-by-Side Difference"),
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -395,7 +395,7 @@ try: with open(fname, "w", encoding="utf-8", newline="") as f: f.write(eol.join(self.contents.toPlainText().splitlines())) - except IOError as why: + except OSError as why: E5MessageBox.critical( self, self.tr('Save Diff'), self.tr(
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnUtilities.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnUtilities.py Sun Nov 22 16:04:59 2020 +0100 @@ -54,7 +54,7 @@ try: with open(config, "w") as f: f.write(DefaultConfig) - except IOError: + except OSError: pass @@ -66,7 +66,7 @@ try: with open(config, "r") as f: configList = f.read().splitlines() - except IOError: + except OSError: return newConfig = [] @@ -103,5 +103,5 @@ try: with open(config, "w") as f: f.write("\n".join(newConfig)) - except IOError: + except OSError: pass
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/subversion.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsSubversion/subversion.py Sun Nov 22 16:04:59 2020 +0100 @@ -2051,7 +2051,7 @@ with open(name, "r", encoding="utf-8") as f1: output2 = f1.read() name2 = name - except IOError: + except OSError: E5MessageBox.critical( self.__ui, self.tr("Subversion Side-by-Side Difference"),
--- a/eric6/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -344,7 +344,7 @@ try: with open(fname, "w", encoding="utf-8") as f: f.write(self.regexpTextEdit.toPlainText()) - except IOError as err: + except OSError as err: E5MessageBox.information( self, self.tr("Save regular expression"), @@ -368,7 +368,7 @@ with open(fname, "r", encoding="utf-8") as f: regexp = f.read() self.regexpTextEdit.setPlainText(regexp) - except IOError as err: + except OSError as err: E5MessageBox.information( self, self.tr("Save regular expression"),
--- a/eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -426,7 +426,7 @@ try: with open(fname, "w", encoding="utf-8") as f: f.write(self.regexpTextEdit.toPlainText()) - except IOError as err: + except OSError as err: E5MessageBox.information( self, self.tr("Save regular expression"), @@ -450,7 +450,7 @@ with open(fname, "r", encoding="utf-8") as f: regexp = f.read() self.regexpTextEdit.setPlainText(regexp) - except IOError as err: + except OSError as err: E5MessageBox.information( self, self.tr("Save regular expression"),
--- a/eric6/Plugins/WizardPlugins/SetupWizard/SetupWizardDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Plugins/WizardPlugins/SetupWizard/SetupWizardDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -149,7 +149,7 @@ try: with open(filename, "r") as f: lines = f.readlines() - except (IOError, OSError) as err: + except OSError as err: E5MessageBox.warning( self, self.tr("Reading Trove Classifiers"),
--- a/eric6/Preferences/ConfigurationPages/EmailPage.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Preferences/ConfigurationPages/EmailPage.py Sun Nov 22 16:04:59 2020 +0100 @@ -217,12 +217,12 @@ self, self.tr("Login Test"), self.tr("""The login test succeeded.""")) - except (smtplib.SMTPException, socket.error) as e: + except (smtplib.SMTPException, OSError) as e: if isinstance(e, smtplib.SMTPResponseException): errorStr = e.smtp_error.decode() elif isinstance(e, socket.timeout): errorStr = str(e) - elif isinstance(e, socket.error): + elif isinstance(e, OSError): try: errorStr = e[1] except TypeError:
--- a/eric6/Project/CreateDialogCodeDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Project/CreateDialogCodeDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -423,7 +423,7 @@ return with open(tmplName, 'r', encoding="utf-8") as tmplFile: template = tmplFile.read() - except IOError as why: + except OSError as why: E5MessageBox.critical( self, self.tr("Code Generation"), @@ -460,7 +460,7 @@ sourceImpl = srcFile.readlines() if not sourceImpl[-1].endswith("\n"): sourceImpl[-1] = "{0}{1}".format(sourceImpl[-1], "\n") - except IOError as why: + except OSError as why: E5MessageBox.critical( self, self.tr("Code Generation"), @@ -553,7 +553,7 @@ try: with open(fn, 'w', encoding="utf-8", newline=newline) as srcFile: srcFile.write("".join(sourceImpl)) - except IOError as why: + except OSError as why: E5MessageBox.critical( self, self.tr("Code Generation"),
--- a/eric6/Project/Project.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Project/Project.py Sun Nov 22 16:04:59 2020 +0100 @@ -1468,7 +1468,7 @@ fn = os.path.join(self.ppath, langFile) if os.path.exists(fn): s2t(fn) - except EnvironmentError as err: + except OSError as err: E5MessageBox.critical( self.ui, self.tr("Delete translation"), @@ -1490,7 +1490,7 @@ fn = os.path.join(self.ppath, qmFile) if os.path.exists(fn): s2t(fn) - except EnvironmentError as err: + except OSError as err: E5MessageBox.critical( self.ui, self.tr("Delete translation"), @@ -1642,7 +1642,7 @@ return # don't overwrite shutil.copy(fn, target) - except IOError as why: + except OSError as why: E5MessageBox.critical( self.ui, self.tr("Add file"), @@ -1701,7 +1701,7 @@ ): try: os.makedirs(target) - except IOError as why: + except OSError as why: E5MessageBox.critical( self.ui, self.tr("Add directory"), @@ -1733,7 +1733,7 @@ # don't overwrite, carry on with next file shutil.copy(file, target) - except EnvironmentError: + except OSError: continue self.appendFile(targetfile) @@ -2209,7 +2209,7 @@ "__pycache__", "{0}.*{1}".format(tail, ext)) for f in glob.glob(pat): s2t(f) - except EnvironmentError as err: + except OSError as err: E5MessageBox.critical( self.ui, self.tr("Delete file"), @@ -2239,7 +2239,7 @@ send2trash(dn) except ImportError: shutil.rmtree(dn, True) - except EnvironmentError as err: + except OSError as err: E5MessageBox.critical( self.ui, self.tr("Delete directory"), @@ -2334,7 +2334,7 @@ if not os.path.isdir(self.ppath): try: os.makedirs(self.ppath) - except EnvironmentError: + except OSError: E5MessageBox.critical( self.ui, self.tr("Create project directory"), @@ -2399,7 +2399,7 @@ try: # create management directory if not present self.createProjectManagementDir() - except EnvironmentError: + except OSError: E5MessageBox.critical( self.ui, self.tr("Create project management directory"), @@ -2420,7 +2420,7 @@ os.makedirs(os.path.dirname(ms)) with open(ms, "w"): pass - except EnvironmentError as err: + except OSError as err: E5MessageBox.critical( self.ui, self.tr("Create main script"), @@ -2444,7 +2444,7 @@ os.makedirs(os.path.dirname(mf)) with open(mf, "w"): pass - except EnvironmentError as err: + except OSError as err: E5MessageBox.critical( self.ui, self.tr("Create Makefile"), @@ -2735,7 +2735,7 @@ try: with open(mf, "w"): pass - except EnvironmentError as err: + except OSError as err: E5MessageBox.critical( self.ui, self.tr("Create Makefile"), @@ -2909,7 +2909,7 @@ try: # create management directory if not present self.createProjectManagementDir() - except EnvironmentError: + except OSError: E5MessageBox.critical( self.ui, self.tr("Create project management directory"), @@ -5281,7 +5281,7 @@ for f in lst])) pkglistFile.write("\n") # ensure the file ends with an empty line - except IOError as why: + except OSError as why: E5MessageBox.critical( self.ui, self.tr("Create Package List"), @@ -5348,7 +5348,7 @@ try: with open(pkglist, "r", encoding="utf-8") as pkglistFile: names = pkglistFile.read() - except IOError as why: + except OSError as why: E5MessageBox.critical( self.ui, self.tr("Create Plugin Archive"), @@ -5404,7 +5404,7 @@ self.pdata["MAINSCRIPT"].replace(".py", ".zip")) try: archiveFile = zipfile.ZipFile(archive, "w") - except IOError as why: + except OSError as why: E5MessageBox.critical( self.ui, self.tr("Create Plugin Archive"), @@ -5513,7 +5513,7 @@ try: sourcelines, encoding = Utilities.readEncodedFile(filename) sourcelines = sourcelines.splitlines(True) - except (IOError, UnicodeError) as why: + except (OSError, UnicodeError) as why: E5MessageBox.critical( self.ui, self.tr("Create Plugin Archive"), @@ -5554,7 +5554,7 @@ try: sourcelines = Utilities.readEncodedFile(filename)[0] sourcelines = sourcelines.splitlines(True) - except (IOError, UnicodeError) as why: + except (OSError, UnicodeError) as why: E5MessageBox.critical( self.ui, self.tr("Create Plugin Archive"),
--- a/eric6/Project/ProjectFormsBrowser.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Project/ProjectFormsBrowser.py Sun Nov 22 16:04:59 2020 +0100 @@ -620,7 +620,7 @@ try: shutil.copy(templateFile, fname) - except IOError as e: + except OSError as e: E5MessageBox.critical( self, self.tr("New Form"), @@ -766,7 +766,7 @@ self.tr("The compilation of the form file" " was successful.")) self.project.projectFormCompiled.emit(self.compiledFile) - except IOError as msg: + except OSError as msg: if not self.noDialog: E5MessageBox.information( self,
--- a/eric6/Project/ProjectResourcesBrowser.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Project/ProjectResourcesBrowser.py Sun Nov 22 16:04:59 2020 +0100 @@ -499,7 +499,7 @@ rcfile.write('<qresource>\n') rcfile.write('</qresource>\n') rcfile.write('</RCC>\n') - except IOError as e: + except OSError as e: E5MessageBox.critical( self, self.tr("New Resource"), @@ -612,7 +612,7 @@ self.tr("Resource Compilation"), self.tr("The compilation of the resource file" " was successful.")) - except IOError as msg: + except OSError as msg: if not self.noDialog: E5MessageBox.information( self, @@ -816,7 +816,7 @@ try: with open(filename, "r", encoding="utf-8") as f: buf = f.read() - except IOError: + except OSError: return False qrcDirName = os.path.dirname(filename)
--- a/eric6/Project/ProjectSourcesBrowser.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Project/ProjectSourcesBrowser.py Sun Nov 22 16:04:59 2020 +0100 @@ -839,7 +839,7 @@ try: with open(packageFile, "w", encoding="utf-8"): pass - except IOError as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Add new Python package"),
--- a/eric6/Project/ProjectTranslationsBrowser.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Project/ProjectTranslationsBrowser.py Sun Nov 22 16:04:59 2020 +0100 @@ -818,7 +818,7 @@ pf.write('\n\n') self.__tmpProjects.append(outFile) - except IOError: + except OSError: E5MessageBox.critical( self, self.tr("Write temporary project file"), @@ -959,7 +959,7 @@ self.__tmpProjects.remove( self.__pylupdateProcesses[index][1]) os.remove(self.__pylupdateProcesses[index][1]) - except EnvironmentError: + except OSError: pass del self.__pylupdateProcesses[index] break @@ -1065,7 +1065,7 @@ try: self.__tmpProjects.remove(tempProjectFile) os.remove(tempProjectFile) - except EnvironmentError: + except OSError: pass def __generateAll(self):
--- a/eric6/Project/QuickFindFileDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Project/QuickFindFileDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -188,7 +188,7 @@ for (_, in_order, name) in possible: try: age = os.stat(os.path.join(self.project.ppath, name)).st_mtime - except (IOError, OSError): + except OSError: # skipping, because it doesn't appear to exist... continue ordered.append((
--- a/eric6/QScintilla/Editor.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/QScintilla/Editor.py Sun Nov 22 16:04:59 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)
--- a/eric6/QScintilla/Exporters/ExporterHTML.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/QScintilla/Exporters/ExporterHTML.py Sun Nov 22 16:04:59 2020 +0100 @@ -456,7 +456,7 @@ with E5OverrideCursor(): with open(filename, "w", encoding="utf-8") as f: f.write(html) - except IOError as err: + except OSError as err: E5MessageBox.critical( self.editor, self.tr("Export source"),
--- a/eric6/QScintilla/Exporters/ExporterPDF.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/QScintilla/Exporters/ExporterPDF.py Sun Nov 22 16:04:59 2020 +0100 @@ -610,7 +610,7 @@ # write required stuff and close the PDF file self.pr.endPDF() - except IOError as err: + except OSError as err: E5MessageBox.critical( self.editor, self.tr("Export source"),
--- a/eric6/QScintilla/Exporters/ExporterRTF.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/QScintilla/Exporters/ExporterRTF.py Sun Nov 22 16:04:59 2020 +0100 @@ -365,7 +365,7 @@ pos += 1 f.write(self.RTF_BODYCLOSE) - except IOError as err: + except OSError as err: E5MessageBox.critical( self.editor, self.tr("Export source"),
--- a/eric6/QScintilla/Exporters/ExporterTEX.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/QScintilla/Exporters/ExporterTEX.py Sun Nov 22 16:04:59 2020 +0100 @@ -275,7 +275,7 @@ # close last empty style macros and document too f.write("}\n} %end tiny\n\n\\end{document}\n") - except IOError as err: + except OSError as err: E5MessageBox.critical( self.editor, self.tr("Export source"),
--- a/eric6/QScintilla/MiniEditor.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/QScintilla/MiniEditor.py Sun Nov 22 16:04:59 2020 +0100 @@ -2530,7 +2530,7 @@ fileName, encoding) else: txt, self.encoding = Utilities.readEncodedFile(fileName) - except (UnicodeDecodeError, IOError) as why: + except (UnicodeDecodeError, OSError) as why: E5MessageBox.critical( self, self.tr('Open File'), self.tr('<p>The file <b>{0}</b> could not be opened.</p>' @@ -2637,7 +2637,7 @@ self.encoding = Utilities.writeEncodedFile( fileName, txt, self.encoding, forcedEncoding=editorConfigEncoding) - except (IOError, Utilities.CodingError, UnicodeError) as why: + except (OSError, Utilities.CodingError, UnicodeError) as why: E5MessageBox.critical( self, self.tr('Save File'), self.tr('<p>The file <b>{0}</b> could not be saved.<br/>'
--- a/eric6/Tasks/TaskViewer.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Tasks/TaskViewer.py Sun Nov 22 16:04:59 2020 +0100 @@ -736,7 +736,7 @@ try: text, encoding = Utilities.readEncodedFile(fn) lines = text.splitlines() - except (UnicodeError, IOError): + except (UnicodeError, OSError): count += 1 progress.setValue(count) continue @@ -852,7 +852,7 @@ try: text, encoding = Utilities.readEncodedFile(fn) lines = text.splitlines() - except (UnicodeError, IOError): + except (UnicodeError, OSError): continue # now search tasks and record them
--- a/eric6/UI/CompareDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/UI/CompareDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -239,7 +239,7 @@ try: with open(filename1, "r", encoding="utf-8") as f1: lines1 = f1.readlines() - except IOError: + except OSError: E5MessageBox.critical( self, self.tr("Compare Files"), @@ -252,7 +252,7 @@ try: with open(filename2, "r", encoding="utf-8") as f2: lines2 = f2.readlines() - except IOError: + except OSError: E5MessageBox.critical( self, self.tr("Compare Files"),
--- a/eric6/UI/DiffDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/UI/DiffDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -140,7 +140,7 @@ f.write(txt) except UnicodeError: pass - except IOError as why: + except OSError as why: E5MessageBox.critical( self, self.tr('Save Diff'), self.tr( @@ -155,12 +155,12 @@ self.filename1 = Utilities.toNativeSeparators(self.file1Picker.text()) try: filemtime1 = time.ctime(os.stat(self.filename1).st_mtime) - except IOError: + except OSError: filemtime1 = "" try: with open(self.filename1, "r", encoding="utf-8") as f1: lines1 = f1.readlines() - except IOError: + except OSError: E5MessageBox.critical( self, self.tr("Compare Files"), @@ -172,12 +172,12 @@ self.filename2 = Utilities.toNativeSeparators(self.file2Picker.text()) try: filemtime2 = time.ctime(os.stat(self.filename2).st_mtime) - except IOError: + except OSError: filemtime2 = "" try: with open(self.filename2, "r", encoding="utf-8") as f2: lines2 = f2.readlines() - except IOError: + except OSError: E5MessageBox.critical( self, self.tr("Compare Files"),
--- a/eric6/UI/EmailDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/UI/EmailDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -330,12 +330,12 @@ try: server.login(Preferences.getUser("MailServerUser"), password) - except (smtplib.SMTPException, socket.error) as e: + except (smtplib.SMTPException, OSError) as e: if isinstance(e, smtplib.SMTPResponseException): errorStr = e.smtp_error.decode() elif isinstance(e, OSError): errorStr = e.strerror - elif isinstance(e, socket.error): + elif isinstance(e, OSError): errorStr = e[1] else: errorStr = str(e) @@ -355,12 +355,12 @@ server.sendmail(Preferences.getUser("Email"), self.__toAddress, msg) server.quit() - except (smtplib.SMTPException, socket.error) as e: + except (smtplib.SMTPException, OSError) as e: if isinstance(e, smtplib.SMTPResponseException): errorStr = e.smtp_error.decode() elif isinstance(e, smtplib.SMTPException): errorStr = str(e) - elif isinstance(e, socket.error): + elif isinstance(e, OSError): errorStr = e.strerror else: errorStr = str(e)
--- a/eric6/UI/ErrorLogDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/UI/ErrorLogDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -52,7 +52,7 @@ with open(logFile, "r", encoding="utf-8") as f: txt = f.read() self.logEdit.setPlainText(txt) - except IOError: + except OSError: pass @pyqtSlot()
--- a/eric6/UI/FindFileDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/UI/FindFileDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -462,7 +462,7 @@ try: text, encoding, hashStr = Utilities.readEncodedFileWithHash(fn) lines = text.splitlines(True) - except (UnicodeError, IOError): + except (UnicodeError, OSError): progress += 1 self.findProgress.setValue(progress) continue @@ -625,7 +625,7 @@ Utilities.readEncodedFileWithHash(fn) ) lines = text.splitlines(True) - except (UnicodeError, IOError) as err: + except (UnicodeError, OSError) as err: E5MessageBox.critical( self, self.tr("Replace in Files"), @@ -666,7 +666,7 @@ txt = "".join(lines) try: Utilities.writeEncodedFile(fn, txt, encoding) - except (IOError, Utilities.CodingError, UnicodeError) as err: + except (OSError, Utilities.CodingError, UnicodeError) as err: E5MessageBox.critical( self, self.tr("Replace in Files"),
--- a/eric6/UI/InstallInfoDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/UI/InstallInfoDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -94,7 +94,7 @@ else self.tr("unknown")) self.__updateButton.setEnabled(bool(self.__info["exe"])) - except EnvironmentError as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Load Install Information"), @@ -183,7 +183,7 @@ json.dump(self.__info, infoFile, indent=2) self.__edited = False self.editButton.setChecked(False) - except EnvironmentError as err: + except OSError as err: E5MessageBox.critical( self, self.tr("Save Install Information"),
--- a/eric6/UI/Previewers/PreviewerHTML.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/UI/Previewers/PreviewerHTML.py Sun Nov 22 16:04:59 2020 +0100 @@ -499,7 +499,7 @@ try: with open(incFile, "r") as f: incTxt = f.read() - except (IOError, OSError): + except OSError: # remove SSI include incTxt = "" else:
--- a/eric6/UI/UserInterface.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/UI/UserInterface.py Sun Nov 22 16:04:59 2020 +0100 @@ -1500,7 +1500,7 @@ installInfo["eric"], os.W_OK) with open(installInfoFile, "w") as infoFile: json.dump(installInfo, infoFile, indent=2) - except EnvironmentError: + except OSError: # ignore this pass else: @@ -5008,7 +5008,7 @@ ' is zero length.</p>') .format(fn)) return - except EnvironmentError: + except OSError: E5MessageBox.critical( self, self.tr('Problem'), @@ -5078,7 +5078,7 @@ ' is zero length.</p>') .format(fn)) return - except EnvironmentError: + except OSError: E5MessageBox.critical( self, self.tr('Problem'), @@ -5248,7 +5248,7 @@ ' is zero length.</p>') .format(fn)) return - except EnvironmentError: + except OSError: E5MessageBox.critical( self, self.tr('Problem'), @@ -5304,7 +5304,7 @@ ' is zero length.</p>') .format(fn)) return - except EnvironmentError: + except OSError: if not ignore: E5MessageBox.critical( self,
--- a/eric6/Utilities/BackgroundClient.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Utilities/BackgroundClient.py Sun Nov 22 16:04:59 2020 +0100 @@ -113,7 +113,7 @@ self.connection.setblocking(False) try: data = self.connection.recv(length, socket.MSG_PEEK) - except socket.error: + except OSError: pass finally: self.connection.setblocking(True) @@ -185,7 +185,7 @@ ret = str(ret) self.__send(fx, fn, ret) - except socket.error: + except OSError: pass except Exception: exctype, excval, exctb = sys.exc_info()
--- a/eric6/Utilities/ClassBrowsers/idlclbr.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Utilities/ClassBrowsers/idlclbr.py Sun Nov 22 16:04:59 2020 +0100 @@ -229,7 +229,7 @@ try: src = Utilities.readEncodedFile(file)[0] - except (UnicodeError, IOError): + except (UnicodeError, OSError): # can't do anything with this module _modules[module] = {} return {}
--- a/eric6/Utilities/ClassBrowsers/jsclbr.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Utilities/ClassBrowsers/jsclbr.py Sun Nov 22 16:04:59 2020 +0100 @@ -305,7 +305,7 @@ try: src = Utilities.readEncodedFile(file)[0] - except (UnicodeError, IOError): + except (UnicodeError, OSError): # can't do anything with this module _modules[module] = {} return {}
--- a/eric6/Utilities/ClassBrowsers/protoclbr.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Utilities/ClassBrowsers/protoclbr.py Sun Nov 22 16:04:59 2020 +0100 @@ -220,7 +220,7 @@ try: src = Utilities.readEncodedFile(file)[0] - except (UnicodeError, IOError): + except (UnicodeError, OSError): # can't do anything with this module _modules[module] = {} return {}
--- a/eric6/Utilities/ClassBrowsers/pyclbr.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Utilities/ClassBrowsers/pyclbr.py Sun Nov 22 16:04:59 2020 +0100 @@ -377,7 +377,7 @@ try: src = Utilities.readEncodedFile(file)[0] - except (UnicodeError, IOError): + except (UnicodeError, OSError): # can't do anything with this module _modules[module] = {} return {}
--- a/eric6/Utilities/ClassBrowsers/rbclbr.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Utilities/ClassBrowsers/rbclbr.py Sun Nov 22 16:04:59 2020 +0100 @@ -276,7 +276,7 @@ try: src = Utilities.readEncodedFile(file)[0] - except (UnicodeError, IOError): + except (UnicodeError, OSError): # can't do anything with this module _modules[module] = {} return {}
--- a/eric6/Utilities/ModuleParser.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Utilities/ModuleParser.py Sun Nov 22 16:04:59 2020 +0100 @@ -1597,7 +1597,7 @@ try: src = Utilities.readEncodedFile(file)[0] mod.scan(src) - except (UnicodeError, IOError): + except (UnicodeError, OSError): pass if caching: _modules[modname] = mod
--- a/eric6/Utilities/__init__.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/Utilities/__init__.py Sun Nov 22 16:04:59 2020 +0100 @@ -661,7 +661,7 @@ """ try: source, encoding = readEncodedFile(filename) - except (UnicodeError, IOError): + except (UnicodeError, OSError): return {} return extractFlags(source) @@ -1251,7 +1251,7 @@ """ try: names = os.listdir(path) - except EnvironmentError: + except OSError: return [] dirs = [] @@ -2040,7 +2040,7 @@ try: with open(rfile, "r") as f: lines = f.read().splitlines() - except IOError: + except OSError: continue info.append(' {0}'.format(rfile))
--- a/eric6/VCS/ProjectHelper.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/VCS/ProjectHelper.py Sun Nov 22 16:04:59 2020 +0100 @@ -246,7 +246,7 @@ if not os.path.isdir(projectdir): try: os.makedirs(projectdir) - except EnvironmentError: + except OSError: E5MessageBox.critical( self.parent(), QCoreApplication.translate(
--- a/eric6/ViewManager/ViewManager.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/ViewManager/ViewManager.py Sun Nov 22 16:04:59 2020 +0100 @@ -4712,7 +4712,7 @@ try: newWin, editor = self.getEditor(fn, filetype=filetype, addNext=addNext, indexes=indexes) - except (IOError, UnicodeDecodeError): + except (OSError, UnicodeDecodeError): return None if newWin: @@ -4881,7 +4881,7 @@ """ try: newWin, self.currentEditor = self.getEditor(fn) - except (IOError, UnicodeDecodeError): + except (OSError, UnicodeDecodeError): return enc = self.currentEditor.getEncoding() @@ -6585,7 +6585,7 @@ try: with open(dictionaryFile, "r", encoding="utf-8") as f: data = f.read() - except (IOError, OSError) as err: + except OSError as err: E5MessageBox.critical( self.ui, QCoreApplication.translate( @@ -6614,7 +6614,7 @@ try: with open(dictionaryFile, "w", encoding="utf-8") as f: f.write(data) - except (IOError, OSError) as err: + except OSError as err: E5MessageBox.critical( self.ui, QCoreApplication.translate(
--- a/eric6/VirtualEnv/VirtualenvExecDialog.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/VirtualEnv/VirtualenvExecDialog.py Sun Nov 22 16:04:59 2020 +0100 @@ -268,7 +268,7 @@ f.write("\n") f.write(self.tr("Errors:\n")) f.write(errtxt) - except (IOError, OSError) as err: + except OSError as err: self.__logError( self.tr("""The logfile '{0}' could not be written.\n""" """Reason: {1}\n""").format(logFile, str(err))) @@ -295,7 +295,7 @@ try: with open(script, "w", encoding="utf-8") as f: f.write(txt) - except (IOError, OSError) as err: + except OSError as err: self.__logError( self.tr("""The script file '{0}' could not be written.\n""" """Reason: {1}\n""").format(script, str(err)))
--- a/eric6/WebBrowser/AdBlock/AdBlockSubscription.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/AdBlock/AdBlockSubscription.py Sun Nov 22 16:04:59 2020 +0100 @@ -473,7 +473,7 @@ try: with open(fileName, "r", encoding="utf-8") as f: data = f.read() - except (IOError, OSError): + except (OSError, OSError): return False match = re.search(self.__checksumRe, data)
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/ChromeImporter.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/ChromeImporter.py Sun Nov 22 16:04:59 2020 +0100 @@ -123,7 +123,7 @@ try: with open(self.__fileName, "r", encoding="utf-8") as f: contents = json.load(f) - except IOError as err: + except OSError as err: self._error = True self._errorString = self.tr( "File '{0}' cannot be read.\nReason: {1}"
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/IExplorerImporter.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/IExplorerImporter.py Sun Nov 22 16:04:59 2020 +0100 @@ -126,7 +126,7 @@ try: with open(path, "r") as f: contents = f.read() - except IOError: + except OSError: continue url = "" for line in contents.splitlines():
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/OperaImporter.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/OperaImporter.py Sun Nov 22 16:04:59 2020 +0100 @@ -100,7 +100,7 @@ try: with open(self.__fileName, "r", encoding="utf-8") as f: contents = f.read() - except IOError as err: + except OSError as err: self._error = True self._errorString = self.tr( "File '{0}' cannot be read.\nReason: {1}"
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/SafariImporter.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/SafariImporter.py Sun Nov 22 16:04:59 2020 +0100 @@ -102,7 +102,7 @@ try: with open(self.__fileName, "rb") as f: bookmarksDict = plistlib.load(f) - except (plistlib.InvalidFileException, EnvironmentError) as err: + except (plistlib.InvalidFileException, OSError) as err: self._error = True self._errorString = self.tr( "Bookmarks file cannot be read.\nReason: {0}".format(str(err)))
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py Sun Nov 22 16:04:59 2020 +0100 @@ -90,7 +90,7 @@ try: with open(self.__fileName, "w", encoding="utf-8") as f: f.write(response) - except (IOError, OSError): + except OSError: self.error.emit() return @@ -145,7 +145,7 @@ try: with open(self.__fileName, "w", encoding="utf-8") as f: f.write(response) - except (IOError, OSError): + except OSError: self.error.emit() return
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Sun Nov 22 16:04:59 2020 +0100 @@ -130,7 +130,7 @@ if deleteScript: try: os.remove(fileName) - except (IOError, OSError): + except OSError: # ignore pass @@ -177,7 +177,7 @@ try: with open(fileName, "r", encoding="utf-8") as f: source = f.read().strip() - except (IOError, OSError): + except OSError: source = "" if source: script += source + "\n"
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py Sun Nov 22 16:04:59 2020 +0100 @@ -276,7 +276,7 @@ try: with open(self.__fileName, "r", encoding="utf-8") as f: fileData = f.read() - except (IOError, OSError): + except OSError: # silently ignore because it shouldn't happen return
--- a/eric6/WebBrowser/Network/ProtocolHandlerManager.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/Network/ProtocolHandlerManager.py Sun Nov 22 16:04:59 2020 +0100 @@ -108,7 +108,7 @@ url = QUrl(urlStr) self.__protocolHandlers[scheme] = url self.__registerHandler(scheme, url) - except (IOError, OSError): + except OSError: # ignore issues silently pass
--- a/eric6/WebBrowser/Session/SessionManager.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/Session/SessionManager.py Sun Nov 22 16:04:59 2020 +0100 @@ -228,7 +228,7 @@ sessionData = json.load(sessionFile) if not cls.isValidSession(sessionData): sessionData = {} - except (IOError, OSError): + except OSError: sessionData = {} return sessionData
--- a/eric6/WebBrowser/Sync/DirectorySyncHandler.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/Sync/DirectorySyncHandler.py Sun Nov 22 16:04:59 2020 +0100 @@ -94,7 +94,7 @@ self._remoteFiles[type_]), "rb" ) as f: data = f.read() - except IOError as err: + except OSError as err: self.syncStatus.emit( type_, self.tr("Cannot read remote file.\n{0}").format(str(err))) @@ -132,7 +132,7 @@ ) as f: f.write(bytes(data)) f.close() - except IOError as err: + except OSError as err: self.syncStatus.emit( type_, self.tr("Cannot write remote file.\n{0}").format(
--- a/eric6/WebBrowser/Sync/FtpSyncHandler.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/Sync/FtpSyncHandler.py Sun Nov 22 16:04:59 2020 +0100 @@ -409,5 +409,5 @@ code = err.args[0].strip()[:3] if code == "421": self.__connected = False - except IOError: + except OSError: self.__connected = False
--- a/eric6/WebBrowser/Sync/SyncHandler.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/Sync/SyncHandler.py Sun Nov 22 16:04:59 2020 +0100 @@ -210,7 +210,7 @@ try: with open(fileName, "rb") as inputFile: data = inputFile.read() - except IOError: + except OSError: return QByteArray() if ( @@ -275,5 +275,5 @@ if timestamp > 0: os.utime(fileName, (timestamp, timestamp)) return True, "" - except IOError as error: + except OSError as error: return False, str(error)
--- a/eric6/WebBrowser/Tools/WebIconProvider.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/WebBrowser/Tools/WebIconProvider.py Sun Nov 22 16:04:59 2020 +0100 @@ -90,7 +90,7 @@ try: with open(filename, "r") as f: db = json.load(f) - except (IOError, OSError): + except OSError: # ignore silentyl db = {} @@ -123,7 +123,7 @@ try: with open(filename, "w") as f: json.dump(db, f) - except (IOError, OSError): + except OSError: # ignore silentyl pass
--- a/eric6/eric6.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/eric6.py Sun Nov 22 16:04:59 2020 +0100 @@ -205,7 +205,7 @@ with open(logFile, "w", encoding="utf-8") as f: f.write(msg) f.write(versionInfo) - except IOError: + except OSError: pass if inMainLoop is None:
--- a/eric6/eric6_api.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/eric6_api.py Sun Nov 22 16:04:59 2020 +0100 @@ -276,7 +276,7 @@ api = apiGenerator.genAPI(True, basePackage, includePrivate) bases = apiGenerator.genBases(includePrivate) - except IOError as v: + except OSError as v: sys.stderr.write("{0} error: {1}\n".format(file, v[1])) continue except ImportError as v: @@ -299,7 +299,7 @@ with open(outputFile, "w", encoding="utf-8", newline=newline) as out: out.write("\n".join(sorted(apis)) + "\n") - except IOError as v: + except OSError as v: sys.stderr.write("{0} error: {1}\n".format(outputFile, v[1])) sys.exit(3) try: @@ -308,7 +308,7 @@ for baseEntry in sorted(basesDict.keys()): out.write("{0} {1}\n".format( baseEntry, " ".join(sorted(basesDict[baseEntry])))) - except IOError as v: + except OSError as v: sys.stderr.write("{0} error: {1}\n".format(basesFile, v[1])) sys.exit(3)
--- a/eric6/eric6_doc.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/eric6_doc.py Sun Nov 22 16:04:59 2020 +0100 @@ -271,7 +271,7 @@ if not os.path.isdir(outputDir): try: os.makedirs(outputDir) - except EnvironmentError: + except OSError: sys.stderr.write( "Could not create output directory {0}.".format(outputDir)) sys.exit(2) @@ -283,7 +283,7 @@ try: with open(stylesheetFile, "r", encoding="utf-8") as sf: stylesheet = sf.read() - except IOError: + except OSError: sys.stderr.write( "The CSS stylesheet '{0}' does not exist\n".format( stylesheetFile)) @@ -299,7 +299,7 @@ if not os.path.isdir(qtHelpOutputDir): try: os.makedirs(qtHelpOutputDir) - except EnvironmentError: + except OSError: sys.stderr.write( "Could not create QtHelp output directory {0}.".format( qtHelpOutputDir)) @@ -372,7 +372,7 @@ inpackage=inpackage, extensions=supportedExtensions) moduleDocument = ModuleDocument(module, colors, stylesheet) doc = moduleDocument.genDocument() - except IOError as v: + except OSError as v: sys.stderr.write("{0} error: {1}\n".format(file, v[1])) continue except ImportError as v: @@ -400,7 +400,7 @@ with open(f, "w", encoding="utf-8", newline=newline) as out: out.write(doc) - except IOError as v: + except OSError as v: sys.stderr.write("{0} error: {1}\n".format(file, v[1])) else: sys.stdout.write("{0} ok\n".format(f))
--- a/eric6/eric6_post_install.py Sat Nov 21 19:31:16 2020 +0100 +++ b/eric6/eric6_post_install.py Sun Nov 22 16:04:59 2020 +0100 @@ -44,7 +44,7 @@ if not os.path.exists(eric6EntryPath): try: os.makedirs(eric6EntryPath) - except EnvironmentError: + except OSError: # maybe restrictions prohibited link creation return
--- a/scripts/create_windows_links.py Sat Nov 21 19:31:16 2020 +0100 +++ b/scripts/create_windows_links.py Sun Nov 22 16:04:59 2020 +0100 @@ -44,7 +44,7 @@ if not os.path.exists(eric6EntryPath): try: os.makedirs(eric6EntryPath) - except EnvironmentError: + except OSError: # maybe restrictions prohibited link creation return
--- a/scripts/install-debugclients.py Sat Nov 21 19:31:16 2020 +0100 +++ b/scripts/install-debugclients.py Sun Nov 22 16:04:59 2020 +0100 @@ -174,7 +174,7 @@ dirname = os.path.join(pyModDir, installPackage) if os.path.exists(dirname): shutil.rmtree(dirname, True) - except (IOError, OSError) as msg: + except OSError as msg: sys.stderr.write( 'Error: {0}\nTry install with admin rights.\n'.format(msg)) exit(7) @@ -220,7 +220,7 @@ # copy the license file shutilCopy(os.path.join(sourceDir, "docs", "LICENSE.GPL3"), targetDir) - except (IOError, OSError) as msg: + except OSError as msg: sys.stderr.write( 'Error: {0}\nTry install with admin rights.\n'.format(msg)) return(7) @@ -297,7 +297,7 @@ shutil.rmtree(distDir, True) else: cleanUp() - except (IOError, OSError) as msg: + except OSError as msg: sys.stderr.write('Error: {0}\nTry install as root.\n'.format(msg)) exit(7)
--- a/scripts/install-i18n.py Sat Nov 21 19:31:16 2020 +0100 +++ b/scripts/install-i18n.py Sun Nov 22 16:04:59 2020 +0100 @@ -78,9 +78,9 @@ for fn in glob.glob(os.path.join('eric', 'eric6', 'i18n', '*.qm')): shutil.copy2(fn, targetDir) os.chmod(os.path.join(targetDir, os.path.basename(fn)), 0o644) - except IOError as msg: + except OSError as msg: sys.stderr.write( - 'IOError: {0}\nTry install-i18n as root.\n'.format(msg)) + 'OSError: {0}\nTry install-i18n as root.\n'.format(msg)) except OSError as msg: sys.stderr.write( 'OSError: {0}\nTry install-i18n with admin rights.\n'.format(msg))
--- a/scripts/install.py Sat Nov 21 19:31:16 2020 +0100 +++ b/scripts/install.py Sun Nov 22 16:04:59 2020 +0100 @@ -574,7 +574,7 @@ if sys.platform == "darwin": # delete the Mac app bundle cleanUpMacAppBundle() - except (IOError, OSError) as msg: + except OSError as msg: sys.stderr.write( 'Error: {0}\nTry install with admin rights.\n'.format(msg)) exit(7) @@ -671,7 +671,7 @@ if os.path.exists(linkPath): try: os.remove(linkPath) - except EnvironmentError: + except OSError: # maybe restrictions prohibited link removal print("Could not remove '{0}'.".format(linkPath)) @@ -684,7 +684,7 @@ if os.path.exists(eric6EntryPath): try: shutil.rmtree(eric6EntryPath) - except EnvironmentError: + except OSError: # maybe restrictions prohibited link removal print("Could not remove '{0}'.".format(eric6EntryPath)) @@ -826,7 +826,7 @@ # create the global plugins directory createGlobalPluginsDir() - except (IOError, OSError) as msg: + except OSError as msg: sys.stderr.write( 'Error: {0}\nTry install with admin rights.\n'.format(msg)) return(7) @@ -836,13 +836,13 @@ try: shutilCopy(os.path.join(sourceDir, "docs", name), cfg['ericDocDir']) - except EnvironmentError: + except OSError: print("Could not install '{0}'.".format( os.path.join(sourceDir, "docs", name))) for name in glob.glob(os.path.join(sourceDir, 'docs', 'README*.*')): try: shutilCopy(name, cfg['ericDocDir']) - except EnvironmentError: + except OSError: print("Could not install '{0}'.".format(name)) # copy some more stuff @@ -850,7 +850,7 @@ try: shutilCopy(os.path.join(sourceDir, "others", name), cfg['ericOthersDir']) - except EnvironmentError: + except OSError: print("Could not install '{0}'.".format( os.path.join(sourceDir, "others", name))) @@ -866,14 +866,14 @@ progLanguage, "*.api")): try: shutilCopy(apiName, apidir) - except EnvironmentError: + except OSError: print("Could not install '{0}' (no permission)." .format(apiName)) for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", progLanguage, "*.bas")): try: shutilCopy(apiName, apidir) - except EnvironmentError: + except OSError: print("Could not install '{0}' (no permission)." .format(apiName)) if progLanguage == "Python": @@ -882,7 +882,7 @@ "Python3", "*.api")): try: shutilCopy(apiName, apidir) - except EnvironmentError: + except OSError: print("Could not install '{0}' (no permission)." .format(apiName)) for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", @@ -892,7 +892,7 @@ apiName.replace(".bas", ".api")))): try: shutilCopy(apiName, apidir) - except EnvironmentError: + except OSError: print("Could not install '{0}' (no permission)." .format(apiName)) @@ -901,7 +901,7 @@ "MicroPython", "*.api")): try: shutilCopy(apiName, apidir) - except EnvironmentError: + except OSError: print("Could not install '{0}' (no permission)." .format(apiName)) for apiName in glob.glob(os.path.join(eric6SourceDir, "APIs", @@ -911,7 +911,7 @@ apiName.replace(".bas", ".api")))): try: shutilCopy(apiName, apidir) - except EnvironmentError: + except OSError: print("Could not install '{0}' (no permission)." .format(apiName)) @@ -1065,7 +1065,7 @@ if not os.path.exists(eric6EntryPath): try: os.makedirs(eric6EntryPath) - except EnvironmentError: + except OSError: # maybe restrictions prohibited link creation return @@ -1737,7 +1737,7 @@ try: os.rename(fileName, fileName + ".orig") - except EnvironmentError: + except OSError: pass try: hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok @@ -1985,7 +1985,7 @@ if os.path.exists(configNameC): os.remove(configNameC) os.remove(configName) - except EnvironmentError: + except OSError: pass # cleanup old installation @@ -1996,7 +1996,7 @@ shutil.rmtree(distDir, True) else: cleanUp() - except (IOError, OSError) as msg: + except OSError as msg: sys.stderr.write('Error: {0}\nTry install as root.\n'.format(msg)) exit(7) @@ -2052,7 +2052,7 @@ if os.path.exists(configNameC): os.remove(configNameC) os.rename(configName + ".orig", configName) - except EnvironmentError: + except OSError: pass try: if installFromSource and infoName: @@ -2061,7 +2061,7 @@ if os.path.exists(infoNameC): os.remove(infoNameC) os.rename(infoName + ".orig", infoName) - except EnvironmentError: + except OSError: pass print("\nInstallation complete.")
--- a/scripts/patch_modpython.py Sat Nov 21 19:31:16 2020 +0100 +++ b/scripts/patch_modpython.py Sun Nov 22 16:04:59 2020 +0100 @@ -84,7 +84,7 @@ filename = os.path.join(modDir, "apache.py") with open(filename, "r", encoding="utf-8") as f: lines = f.readlines() - except EnvironmentError: + except OSError: print("The file {0} does not exist. Aborting.".format(filename)) sys.exit(1)
--- a/scripts/uninstall-debugclients.py Sat Nov 21 19:31:16 2020 +0100 +++ b/scripts/uninstall-debugclients.py Sun Nov 22 16:04:59 2020 +0100 @@ -80,7 +80,7 @@ dirname = os.path.join(pyModDir, installPackage) if os.path.exists(dirname): shutil.rmtree(dirname, True) - except (IOError, OSError) as msg: + except OSError as msg: sys.stderr.write( 'Error: {0}\nTry uninstall with admin rights.\n'.format(msg)) exit(7)
--- a/scripts/uninstall.py Sat Nov 21 19:31:16 2020 +0100 +++ b/scripts/uninstall.py Sun Nov 22 16:04:59 2020 +0100 @@ -195,7 +195,7 @@ removeConfigurationData() print("\nUninstallation completed") - except (IOError, OSError) as msg: + except OSError as msg: sys.stderr.write( 'Error: {0}\nTry uninstall with admin rights.\n'.format(msg)) exit(7) @@ -226,7 +226,7 @@ if os.path.exists(linkPath): try: os.remove(linkPath) - except EnvironmentError: + except OSError: # maybe restrictions prohibited link removal print("Could not remove '{0}'.".format(linkPath)) @@ -239,7 +239,7 @@ if os.path.exists(eric6EntryPath): try: shutil.rmtree(eric6EntryPath) - except EnvironmentError: + except OSError: # maybe restrictions prohibited link removal print("Could not remove '{0}'.".format(eric6EntryPath))
--- a/setup.py Sat Nov 21 19:31:16 2020 +0100 +++ b/setup.py Sun Nov 22 16:04:59 2020 +0100 @@ -137,7 +137,7 @@ try: os.rename(fileName, fileName + ".orig") - except EnvironmentError: + except OSError: pass try: hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok @@ -172,7 +172,7 @@ try: os.rename(fileName, fileName + ".orig") - except EnvironmentError: + except OSError: pass with open(fileName + ".orig", "r", encoding="utf-8") as f: text = f.read() @@ -399,5 +399,5 @@ try: os.remove(fileName) os.rename(fileName + ".orig", fileName) - except EnvironmentError: + except OSError: pass