From db80c72b08506ba03c6c33c5a2e56db8a88f349e Mon Sep 17 00:00:00 2001 From: Eric Blundell Date: Tue, 20 Mar 2018 08:27:44 -0500 Subject: [PATCH] Create file_name directory trees in download_worker --- pyrogram/client/client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 9955dd77..c2854796 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -516,6 +516,9 @@ class Client: # Make file_dir if it was specified os.makedirs(file_dir, exist_ok=True) + if file_name is not None: + os.makedirs(os.path.dirname(file_name), exist_ok=True) + if isinstance(media, types.MessageMediaDocument): document = media.document