From 50313580fd8e9582fd85dc283a1eadadda619e6f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 12 Jul 2019 18:19:32 +0200 Subject: [PATCH] Catch PortAudio exception in case of race conditions on closed streams and re-initialize the assistant object when they occur --- platypush/plugins/assistant/google/pushtotalk.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/assistant/google/pushtotalk.py b/platypush/plugins/assistant/google/pushtotalk.py index ffe8eeccda..bbda8e8b2b 100644 --- a/platypush/plugins/assistant/google/pushtotalk.py +++ b/platypush/plugins/assistant/google/pushtotalk.py @@ -235,7 +235,12 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin): continue_conversation = True while continue_conversation: - continue_conversation = self.assistant.assist() + try: + continue_conversation = self.assistant.assist() + except Exception as e: + self.logger.warning('Unhandled assistant exception: {}'.format(str(e))) + self.logger.exception(e) + self._init_assistant() return self.interactions