From c351dbe00be8749ca51199ce3f37274fe77ed7f6 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 9 May 2017 22:39:10 +0200 Subject: [PATCH] catch Exception --- src/fenrir/speechDriver/genericDriver.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/fenrir/speechDriver/genericDriver.py b/src/fenrir/speechDriver/genericDriver.py index 98141b8a..c521637f 100644 --- a/src/fenrir/speechDriver/genericDriver.py +++ b/src/fenrir/speechDriver/genericDriver.py @@ -43,7 +43,8 @@ class driver(): if self.speechCommand == '': self.speechCommand = 'espeak -a fenrirVolume -s fenrirRate -p fenrirPitch -v fenrirVoice "fenrirText"' if False: #for debugging overwrite here - self.speechCommand = 'spd-say --wait -r 100 -i 100 "fenrirText"' + #self.speechCommand = 'spd-say --wait -r 100 -i 100 "fenrirText"' + self.speechCommand = 'flite -t "fenrirText"' self._isInitialized = True if self._isInitialized: @@ -78,10 +79,13 @@ class driver(): if self.proc: try: self.proc.terminate() - except: - self.proc.kill() - finally: - self.proc = None + except Exception as e: + self.env['runtime']['debug'].writeDebugOut('speechDriver:Cancel:self.proc.terminate():' + str(e),debug.debugLevel.ERROR) + try: + self.proc.kill() + except Exception as e: + self.env['runtime']['debug'].writeDebugOut('speechDriver:Cancel:self.proc.kill():' + str(e),debug.debugLevel.ERROR) + self.proc = None self.lock.release() def setCallback(self, callback): print('SpeechDummyDriver: setCallback')