From 3e511484c785f430d233da481931d06256a51df1 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 6 Jun 2020 21:07:22 +0200 Subject: [PATCH] Support pathlib.Path on download_file Fixes #1379. --- telethon/client/downloads.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index 334f28a4..1b06bfe6 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -443,6 +443,9 @@ class DownloadMethods: raise ValueError( 'The part size must be evenly divisible by 4096.') + if isinstance(file, pathlib.Path): + file = str(file.absolute()) + in_memory = file is None or file is bytes if in_memory: f = io.BytesIO()