From f676005de5782f53a55e71bd395165c04f10e2fe Mon Sep 17 00:00:00 2001 From: Lonami Date: Tue, 9 Jul 2019 11:39:29 +0200 Subject: [PATCH] Update downloads.py --- telethon/client/downloads.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index c5a00358..67388e44 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -439,7 +439,8 @@ class DownloadMethods: if inspect.isawaitable(r): await r - if hasattr(f, 'flush') and callable(getattr(f, 'flush')): + # Not all IO objects have flush (see #1227) + if callable(getattr(f, 'flush', None)): f.flush() if in_memory: