From 78e89d27ed204716f73236e7351e365b01854672 Mon Sep 17 00:00:00 2001 From: mudler Date: Sat, 5 Aug 2023 01:03:38 +0200 Subject: [PATCH] Add try --- main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index eba9cff..d72e2a5 100644 --- a/main.py +++ b/main.py @@ -148,10 +148,13 @@ def tts(input_text, model=VOICE_MODEL): else: logger.info('Request failed with status code', response.status_code) - # Use aplay to play the audio - os.system('aplay ' + output_file_path) - # remove the audio file - os.remove(output_file_path) + try: + # Use aplay to play the audio + os.system('aplay ' + output_file_path) + # remove the audio file + os.remove(output_file_path) + except: + logger.info('Unable to play audio') # Function to analyze the user input and pick the next action to do def needs_to_do_action(user_input,agent_actions={}):