mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +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
1 changed files with 1 additions and 5 deletions
|
|
@ -734,13 +734,9 @@ 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)
|
||||||
|
file.close()
|
||||||
shutil.move(file.name, file_path)
|
shutil.move(file.name, file_path)
|
||||||
|
|
||||||
try:
|
|
||||||
file.close()
|
|
||||||
except FileNotFoundError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return file_path
|
return file_path
|
||||||
|
|
||||||
if file and in_memory:
|
if file and in_memory:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue