2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Fix saving files on another drive (windows) @EriHoss

This commit is contained in:
Dan 2018-03-21 15:42:32 +01:00 committed by GitHub
parent f6ea3e9b42
commit 76ad29ae11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)