diff options
| author | Nakidai <nakidai@disroot.org> | 2024-10-31 23:54:35 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2024-10-31 23:54:35 +0300 |
| commit | 815382fe0c48a2fc2af1c256b3e52a9f3433e20a (patch) | |
| tree | e80c5e121bfc2957ef6bedaa7e4e7a83d9898a47 | |
| parent | 0bb56522b506d3014b178fe73bd5db6d6cc680ad (diff) | |
| download | petthecord-815382fe0c48a2fc2af1c256b3e52a9f3433e20a.tar.gz petthecord-815382fe0c48a2fc2af1c256b3e52a9f3433e20a.zip | |
Add warning on except
| -rw-r--r-- | src/petthecord/cache.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/petthecord/cache.py b/src/petthecord/cache.py index 2642a44..d111e99 100644 --- a/src/petthecord/cache.py +++ b/src/petthecord/cache.py @@ -104,10 +104,11 @@ class CachedPet: if path.is_file() and filename != "index.json": if (time() - getmtime(path) > self._lifetime): self._logger.debug(f"Removing {filename}") + to_delete = filename.split('_')[0] try: - del self._cache[filename.split('_')[0]] + del self._cache[to_delete] except KeyError: - pass + self._logger.warning(f"{to_delete} has been already removed from the index") remove(path) with open(self._path / "index.json", "w") as f: dump(self._cache, f) |