From 956b3ce54d3c25faa35eb761ef66b6df158166a3 Mon Sep 17 00:00:00 2001 From: Andreas Raster Date: Fri, 24 Nov 2017 19:01:43 +0100 Subject: [PATCH] [FIX] server: ignore broken symlinks Previously broken symlinks would cause a FileNotFoundError exception in the filesystem watcher thread spawned when using the --dev=reload argument. This problem appeared when using emacs to edit python files while they are being watched by an odoo instance for changes. Emacs creates a broken symlink as lockfile in the same directory as the python file that it edits. This commit makes the filesystem watcher silently ignore any FileNotFoundError that occurs when it tries to open a file. Fixes #21214, closes #21215 --- odoo/service/server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odoo/service/server.py b/odoo/service/server.py index c0deb3989d7..d9beb9f6378 100644 --- a/odoo/service/server.py +++ b/odoo/service/server.py @@ -134,6 +134,8 @@ class FSWatcher(object): try: source = open(path, 'rb').read() + '\n' compile(source, path, 'exec') + except FileNotFoundError: + _logger.error('autoreload: python code change detected, FileNotFound for %s', path) except SyntaxError: _logger.error('autoreload: python code change detected, SyntaxError in %s', path) else: