From 9decd5899287e5afe834cc84ce3b5f3fea66cb30 Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 18 Jul 2019 20:44:17 -0400 Subject: [PATCH] Use aiofiles for image provider file writes --- TODO.md | 1 + src/python/image_provider.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index baaeb68a..c8dd3d2d 100644 --- a/TODO.md +++ b/TODO.md @@ -13,6 +13,7 @@ - Refactoring - Use .mjs modules + - SignIn/RememberAccount screens - Don't bake in size properties for components - Unfinished work in button-refactor branch - Button can get "hoverEnabled: false" to let HoverHandlers work diff --git a/src/python/image_provider.py b/src/python/image_provider.py index b15fb099..59a89134 100644 --- a/src/python/image_provider.py +++ b/src/python/image_provider.py @@ -9,7 +9,7 @@ from pathlib import Path from typing import Tuple from urllib.parse import urlparse -from atomicfile import AtomicFile +import aiofiles from dataclasses import dataclass, field from PIL import Image as PILImage @@ -108,8 +108,8 @@ class Thumbnail: self.local_path.parent.mkdir(parents=True, exist_ok=True) - with AtomicFile(str(self.local_path), "wb") as file: - file.write(body) + async with aiofiles.open(self.local_path, "wb") as file: + await file.write(body) return body