From ad5ec33869860685921e3fe7bdd3a4589f7f7032 Mon Sep 17 00:00:00 2001 From: Davte Date: Fri, 26 Jul 2019 10:36:30 +0200 Subject: [PATCH] Close buffered_file only if it exists --- davtelepot/bot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/davtelepot/bot.py b/davtelepot/bot.py index 6b403fb..67e156f 100644 --- a/davtelepot/bot.py +++ b/davtelepot/bot.py @@ -1310,7 +1310,8 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject): ['path'] ) finally: - buffered_file.close() + if buffered_file: + buffered_file.close() if ( type(sent_update) is dict and 'document' in sent_update