From a8759a37cc6c694c25c23011b616afa2ec827071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 19 Dec 2024 12:17:03 +0100 Subject: [PATCH] Be sure that the config file exists --- tilecloud_chain/multitilestore.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tilecloud_chain/multitilestore.py b/tilecloud_chain/multitilestore.py index 31b3fa2fa..603f28212 100644 --- a/tilecloud_chain/multitilestore.py +++ b/tilecloud_chain/multitilestore.py @@ -29,7 +29,11 @@ def __init__(self, get_store: Callable[[str, str], TileStore | None]) -> None: self.stores: dict[tuple[str, str], _DatedStore | None] = {} def _get_store(self, config_file: str, layer: str) -> TileStore | None: - mtime = Path(config_file).stat().st_mtime + config_path = Path(config_file) + if not config_path.exists(): + logger.warning("Config file %s does not exist", config_file) + return None + mtime = config_path.stat().st_mtime store = self.stores.get((config_file, layer)) if store is not None and store.mtime != mtime: store = None