From 9ebd2a874874f9ba18ebb95dd0e590baaace8cb5 Mon Sep 17 00:00:00 2001 From: oloturia Date: Thu, 27 May 2021 16:06:15 +0200 Subject: [PATCH] fixed file not closed --- telegram_main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/telegram_main.py b/telegram_main.py index 94fa59b..17e3f2f 100755 --- a/telegram_main.py +++ b/telegram_main.py @@ -12,7 +12,9 @@ def newStrip(bot, update, args): status = createStrip(config) if status == 0: try: - bot.send_photo(chat_id=update.message.chat_id,photo=open(config["saveLocation"]+config["filename"],"rb")) + strip_file=open(config["saveLocation"]+config["filename"],"rb") + bot.send_photo(chat_id=update.message.chat_id,photo=strip_file) + strip_file.close() except Exception as err: print(err) else: