mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Close the downloaded file before moving it (#964)
* download media on windows fix mmmmmmmm * Style fixes Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
parent
3c08d02c20
commit
240659f616
@ -734,13 +734,9 @@ class Client(Methods):
|
||||
if file and not in_memory:
|
||||
file_path = os.path.abspath(re.sub("\\\\", "/", os.path.join(directory, file_name)))
|
||||
os.makedirs(directory, exist_ok=True)
|
||||
file.close()
|
||||
shutil.move(file.name, file_path)
|
||||
|
||||
try:
|
||||
file.close()
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
return file_path
|
||||
|
||||
if file and in_memory:
|
||||
|
Loading…
Reference in New Issue
Block a user