From 76ad29ae11099bce3137633cfba9d1a141838347 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 21 Mar 2018 15:42:32 +0100 Subject: [PATCH] Fix saving files on another drive (windows) @EriHoss --- pyrogram/client/client.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index ea77ff75..dd0d64fe 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -574,13 +574,8 @@ class Client: if temp_file_path: final_file_path = os.path.join(directory, file_name) - - try: - os.remove(final_file_path) - except OSError: - pass - - os.renames(temp_file_path, final_file_path) + os.makedirs(directory, exist_ok=True) + shutil.move(temp_file_path, final_file_path) except Exception as e: log.error(e, exc_info=True)