From 1650dc7163e5b97422406688e6a295aebef186dc Mon Sep 17 00:00:00 2001 From: Erik Harding Date: Thu, 15 Feb 2024 13:35:11 +0200 Subject: [PATCH] Use ful path of the image file --- vaccine/real411.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vaccine/real411.py b/vaccine/real411.py index 498cc8f4..d9c900d4 100644 --- a/vaccine/real411.py +++ b/vaccine/real411.py @@ -5,6 +5,7 @@ from urllib.parse import urljoin import aiohttp +import pkg_resources from aiohttp_client_cache import CacheBackend, CachedSession from vaccine import real411_config as config @@ -522,7 +523,10 @@ async def state_submit_report(self): ) as session: for file, file_url in zip(files, file_urls): if file["name"] == "placeholder": - with open("vaccine/data/real411_placeholder.png", "rb") as f: + filename = pkg_resources.resource_filename( + "vaccine", "data/real411_placeholder.png" + ) + with open(filename, "rb") as f: file_data = f.read() else: file_data = await get_whatsapp_media(file["name"])