From c68fa34b92191047748cb79102a9b2cf404cc213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anger=20J=C3=A9r=C3=A9my?= Date: Fri, 19 Jan 2024 16:56:24 +0100 Subject: [PATCH] download: don't write a lock file if not necessary this is needed on read-only filesystems --- srtm4/download.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/srtm4/download.py b/srtm4/download.py index ffdb9cb..6d6254e 100644 --- a/srtm4/download.py +++ b/srtm4/download.py @@ -96,9 +96,10 @@ def get_srtm_tile(srtm_tile, out_dir): # the tif file is either being written or finished writing # locking will ensure it is not being written. # Also by construction we won't write on something complete. - lock_tif = filelock.FileLock(srtm_tif_write_lock) - lock_tif.acquire() - lock_tif.release() + if os.path.exists(srtm_tif_write_lock): + lock_tif = filelock.FileLock(srtm_tif_write_lock) + lock_tif.acquire() + lock_tif.release() return # download the zip file