--- a/src/eric7/EricCore/EricFileSystemWatcher.py Sat Apr 20 18:02:35 2024 +0200 +++ b/src/eric7/EricCore/EricFileSystemWatcher.py Sat Apr 20 19:56:02 2024 +0200 @@ -150,6 +150,7 @@ @signal fileModified(path: str) emitted when a file is modified @signal fileMoved(srcPath: str, dstPath: str) emitted when the file at a given source path is renamed or moved to destination path + @signal error(errno: int, errmsg: str) emitted to indicate an OS error """ directoryChanged = pyqtSignal(str) # compatibility with QFileSystemWatcher @@ -164,6 +165,8 @@ fileModified = pyqtSignal(str) fileMoved = pyqtSignal(str, str) + error = pyqtSignal(int, str) + def __init__(self, parent=None): """ Constructor @@ -251,14 +254,17 @@ self.__paths[path][1] += 1 return True except KeyError: - watch = self.__observer.schedule( - self.__eventHandler, - path, - recursive=recursive and os.path.isdir(path), - ) - if watch is not None: - self.__paths[watch.path] = [watch, 1] - return True + try: + watch = self.__observer.schedule( + self.__eventHandler, + path, + recursive=recursive and os.path.isdir(path), + ) + if watch is not None: + self.__paths[watch.path] = [watch, 1] + return True + except OSError as err: + self.error.emit(err.errno, err.strerror) return False