From 5e01276ec24239f2cd7b7cdf3f491480be254349 Mon Sep 17 00:00:00 2001 From: Tilman Kamp <5991088+tilmankamp@users.noreply.github.com> Date: Thu, 28 Nov 2019 16:39:13 +0100 Subject: [PATCH] Closing OS file descriptors for tmp files --- align/audio.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/align/audio.py b/align/audio.py index 298aaf2..dddafe1 100644 --- a/align/audio.py +++ b/align/audio.py @@ -42,7 +42,8 @@ def ensure_wav_with_format(src_audio_path, audio_format=DEFAULT_FORMAT): with wave.open(src_audio_path, 'r') as src_audio_file: if get_audio_format(src_audio_file) == audio_format: return src_audio_path, False - _, tmp_file_path = tempfile.mkstemp(suffix='.wav') + fd, tmp_file_path = tempfile.mkstemp(suffix='.wav') + os.close(fd) convert_audio(src_audio_path, tmp_file_path, file_type='wav', audio_format=audio_format) return tmp_file_path, True