From 4c2eee6a133785ac651b4818977661d0ac6008dd Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 25 Jan 2018 15:42:51 +0100 Subject: Fix caching newer avatars. --- poezio/core/handlers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index a7a0797b..59ab9f37 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -427,10 +427,11 @@ class HandlerCore: # Now we save the data on the file system to not have to request it again. try: - makedirs(cache_dir) + makedirs(cache_dir, exist_ok=True) with open(cached_path, 'wb') as avatar_file: avatar_file.write(contact.avatar) except OSError: + log.debug('Failed writing %s avatar to cache:', jid, exc_info=True) pass return @@ -467,10 +468,11 @@ class HandlerCore: # Now we save the data on the file system to not have to request it again. try: - makedirs(cache_dir) + makedirs(cache_dir, exist_ok=True) with open(cached_path, 'wb') as avatar_file: avatar_file.write(contact.avatar) except OSError: + log.debug('Failed writing %s avatar to cache:', jid, exc_info=True) pass def on_nick_received(self, message): -- cgit v1.2.3