From 47cb16d931f2c0fa7420364ecca7cc68b2e531de Mon Sep 17 00:00:00 2001 From: Adrien Beudin Date: Wed, 12 Jul 2017 13:39:45 +0200 Subject: [PATCH] fix cache in python3 --- prosopopee/cache.py | 5 ++--- prosopopee/prosopopee.py | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/prosopopee/cache.py b/prosopopee/cache.py index 6f4528c..48c94a6 100644 --- a/prosopopee/cache.py +++ b/prosopopee/cache.py @@ -53,8 +53,7 @@ class Cache(object): def cache_picture(self, source, target, options): self.cache[target] = {"size": os.path.getsize(source), "options": remove_superficial_options(options)} - def __del__(self): - self.json.dump(self.cache, open(self.cache_file_path, "wb")) - + def cache_dump(self): + self.json.dump(self.cache, open(self.cache_file_path, "w")) CACHE = Cache(json=json) diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index b482751..9b00ee1 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -601,6 +601,7 @@ def main(): open(Path("build").joinpath("feed.xml"), "wb").write(xml) build_index(settings, front_page_galleries_cover, templates) + CACHE.cache_dump() if __name__ == '__main__':