close files properly
This commit is contained in:
@@ -121,7 +121,9 @@ async def _main(srt_data, voice_name, out_file):
|
|||||||
try:
|
try:
|
||||||
ensure_audio_length(fname, temporary_file.name, duration)
|
ensure_audio_length(fname, temporary_file.name, duration)
|
||||||
finally:
|
finally:
|
||||||
|
temporary_file.close()
|
||||||
shutil.move(temporary_file.name, fname)
|
shutil.move(temporary_file.name, fname)
|
||||||
|
temporary_file = None
|
||||||
|
|
||||||
ffmpeg_opts = []
|
ffmpeg_opts = []
|
||||||
for i in range(len(input_files)):
|
for i in range(len(input_files)):
|
||||||
@@ -156,8 +158,11 @@ async def _main(srt_data, voice_name, out_file):
|
|||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
|
temporary_file2.close()
|
||||||
|
mother_temp_file.close()
|
||||||
shutil.move(temporary_file2.name, mother_temp_file.name)
|
shutil.move(temporary_file2.name, mother_temp_file.name)
|
||||||
finally:
|
finally:
|
||||||
|
mother_temp_file.close()
|
||||||
shutil.move(mother_temp_file.name, out_file)
|
shutil.move(mother_temp_file.name, out_file)
|
||||||
print("Done")
|
print("Done")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user