From 2fd0c42804ef639955012536359b61cc08cdf775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=ADdac=20Sabat=C3=A9s?= Date: Mon, 13 Jun 2022 20:04:02 +0200 Subject: [PATCH] Fix upload --- pibooth_telegram_upload.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pibooth_telegram_upload.py b/pibooth_telegram_upload.py index abf7cb6..a0c89ff 100644 --- a/pibooth_telegram_upload.py +++ b/pibooth_telegram_upload.py @@ -61,13 +61,13 @@ def state_processing_exit(app, cfg): """Upload picture to Telegram chat""" if hasattr(app, "telegram_client"): chat_id = cfg.get(SECTION, "telegram_chat_id").strip('"') - upload_path = os.path.basename(app.previous_picture_file) + # upload_path = os.path.basename(app.previous_picture_file) message = cfg.get(SECTION, "telegram_message") try: response = app.telegram_client.send_photo( chat_id=chat_id, caption=message, - photo=app.previous_picture_file, + photo=open(app.previous_picture_file, 'rb'), parse_mode=telegram.ParseMode.MARKDOWN, ) LOGGER.info("File uploaded to Telegram chat: " + response)