diff -r 58c7f23ae1cb -r a9134b4e8ed0 src/eric7/ViewManager/ViewManager.py --- a/src/eric7/ViewManager/ViewManager.py Sat Apr 20 18:02:35 2024 +0200 +++ b/src/eric7/ViewManager/ViewManager.py Sat Apr 20 19:56:02 2024 +0200 @@ -147,6 +147,7 @@ # initialize the file system watcher watcher = EricFileSystemWatcher.instance() watcher.fileModified.connect(self.__watchedFileChanged) + watcher.error.connect(self.__watcherError) self.__watchedFilePaths = [] @@ -5712,7 +5713,8 @@ newWin, editor = self.getEditor( fn, filetype=filetype, addNext=addNext, indexes=indexes ) - except (OSError, UnicodeDecodeError): + except (OSError, UnicodeDecodeError) as err: + print(str(err)) return None if newWin: @@ -6107,6 +6109,9 @@ filetype=filetype, tv=ericApp().getObject("TaskViewer"), ) + + self.addWatchedFilePath(fn) + editor = assembly.getEditor() self.editors.append(editor) self.__connectEditor(editor) @@ -6115,8 +6120,6 @@ self.editorOpenedEd.emit(editor) self.editorCountChanged.emit(len(self.editors)) - self.addWatchedFilePath(fn) - newWin = True if newWin: @@ -8067,6 +8070,43 @@ for editor in editorList: editor.recordModificationTime() + @pyqtSlot(int, str) + def __watcherError(self, errno, strerror): + """ + Private slot to handle an error of the file system watcher. + + @param errno numeric error code + @type int + @param strerror error message as provided by the operating system + @type str + """ + if errno == 24: + EricMessageBox.critical( + self, + self.tr("File System Watcher Error"), + self.tr( + """<p>The operating system resources for file system watches""" + """ are exhausted. This limit should be increased. On a Linux""" + """ system you should """ + """<ul>""" + """<li>sudo nano /etc/sysctl.conf</li>""" + """<li>add to the bottom "fs.inotify.max_user_instances""" + """ = 1024"</li>""" + """<li>save and close the editor</li>""" + """<li>sudo sysctl -p</li>""" + """</ul></p><p>Error Message: {0}</p>""" + ).format(strerror), + ) + else: + EricMessageBox.critical( + self, + self.tr("File System Watcher Error"), + self.tr( + "The file system watcher reported an error with code <b>{0}</b>." + "</p><p>Error Message: {1}</p>" + ).format(errno, strerror) + ) + def addWatchedFilePath(self, filePath): """ Public method to add a file to the list of monitored files.