diff --git a/src/otf_api/utils.py b/src/otf_api/utils.py index 999d6bf..8d1e464 100644 --- a/src/otf_api/utils.py +++ b/src/otf_api/utils.py @@ -51,6 +51,13 @@ def write_to_cache(self, data: dict[str, str]) -> None: """Writes the data to the cache file.""" LOGGER.debug(f"Writing {self.name} to cache ({self.cache_path})") + # double check everything exists + if not self.cache_path.parent.exists(): + self.cache_path.parent.mkdir(parents=True, exist_ok=True) + + if not self.cache_path.exists(): + self.cache_path.touch() + existing_data = self.get_cached_data() data = {**existing_data, **data}