From bc34ebdff934bd2d3720305666825cfbc98df554 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Tue, 21 May 2024 06:06:01 -0400 Subject: [PATCH] filelock: fix lockfile cleanup Python 3.7 does not support the "missing_ok" argument in pathlib.unlink(). Signed-off-by: Eric Callahan --- moonraker/utils/filelock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moonraker/utils/filelock.py b/moonraker/utils/filelock.py index 9ce06218a..32fd3915a 100644 --- a/moonraker/utils/filelock.py +++ b/moonraker/utils/filelock.py @@ -96,7 +96,8 @@ async def acquire(self) -> None: def _release_file(self) -> None: with contextlib.suppress(OSError, PermissionError): - self.lock_path.unlink(missing_ok=True) + if self.lock_path.is_file(): + self.lock_path.unlink() with contextlib.suppress(OSError, PermissionError): fcntl.flock(self.fd, fcntl.LOCK_UN) with contextlib.suppress(OSError, PermissionError):