diff --git a/CHANGELOG.md b/CHANGELOG.md index 45cc279..a2295bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [unreleased] -- +* Ignore FileNotFoundError when trying to get the last modified time of files + in directories. This happens for example with temporary emacs files. * Added changelog to docs * removed ruff's target-version from pyproject.toml, this value defaults to the projects requires-python diff --git a/blag/devserver.py b/blag/devserver.py index 1945740..2dd6481 100644 --- a/blag/devserver.py +++ b/blag/devserver.py @@ -42,7 +42,12 @@ def get_last_modified(dirs: list[str]) -> float: for dir in dirs: for root, dirs, files in os.walk(dir): for f in files: - mtime = os.stat(os.path.join(root, f)).st_mtime + try: + mtime = os.stat(os.path.join(root, f)).st_mtime + except FileNotFoundError: + # ignore files that have been deleted since the os.walk + # call (for example temporary emacs files) + continue if mtime > last_mtime: last_mtime = mtime