From 811c111b2dc169452e1465f472d656683c6aed8e Mon Sep 17 00:00:00 2001 From: SevaSk Date: Thu, 1 Jun 2023 14:46:48 -0400 Subject: [PATCH] catching exceptions when making temp_file --- AudioTranscriber.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AudioTranscriber.py b/AudioTranscriber.py index 0002d20..6be40b8 100644 --- a/AudioTranscriber.py +++ b/AudioTranscriber.py @@ -47,7 +47,11 @@ class AudioTranscriber: source_info = self.audio_sources[who_spoke] text = '' - temp_file = NamedTemporaryFile(delete=False, suffix=".wav") + try: + temp_file = NamedTemporaryFile(delete=False, suffix=".wav") + except Exception as e: + print(e) + temp_file.close() source_info["process_data_func"](source_info["last_sample"], temp_file.name)