mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 20:59:29 +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,12 +734,8 @@ class Client(Methods):
|
|||||||
if file and not in_memory:
|
if file and not in_memory:
|
||||||
file_path = os.path.abspath(re.sub("\\\\", "/", os.path.join(directory, file_name)))
|
file_path = os.path.abspath(re.sub("\\\\", "/", os.path.join(directory, file_name)))
|
||||||
os.makedirs(directory, exist_ok=True)
|
os.makedirs(directory, exist_ok=True)
|
||||||
shutil.move(file.name, file_path)
|
|
||||||
|
|
||||||
try:
|
|
||||||
file.close()
|
file.close()
|
||||||
except FileNotFoundError:
|
shutil.move(file.name, file_path)
|
||||||
pass
|
|
||||||
|
|
||||||
return file_path
|
return file_path
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user