From 8796e857af44918a05cf37fb3b5f42cbca6fb7c4 Mon Sep 17 00:00:00 2001 From: Eric Blundell Date: Tue, 20 Mar 2018 23:20:08 -0500 Subject: [PATCH] Amend comment on shutil.move in download_worker os.renames cannot move across drives/partitions on any platform. that is why shutil.move is used, because the OS allotted temp file could possibly be on another drive or partition. Also fix code formatting on new import statements. --- pyrogram/client/client.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 211a23d5..26d5e9df 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -35,9 +35,7 @@ from queue import Queue from signal import signal, SIGINT, SIGTERM, SIGABRT from threading import Event, Thread import tempfile - import shutil - import errno from pyrogram.api import functions, types @@ -599,7 +597,7 @@ class Client: else: os.makedirs(os.path.dirname(file_name), exist_ok=True) - # avoid errors moving between drives on windows + # avoid errors moving between drives/partitions etc. shutil.move(tmp_file_name, os.path.join(download_directory, file_name)) except OSError as e: log.error(e, exc_info=True)