From 8433aac1ed4c6084beb3fccf964af7bed59caa45 Mon Sep 17 00:00:00 2001 From: Jezra Date: Sun, 9 Nov 2014 18:57:59 -0800 Subject: *slightly* improved the error handling.... slightly --- Blather.py | 7 ++++++- Recognizer.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Blather.py b/Blather.py index 9ad5e14..ed5e6ed 100755 --- a/Blather.py +++ b/Blather.py @@ -76,7 +76,12 @@ class Blather: self.history = [] #create the recognizer - self.recognizer = Recognizer(lang_file, dic_file, self.options['microphone'] ) + try: + self.recognizer = Recognizer(lang_file, dic_file, self.options['microphone'] ) + except Exception, e: + #no recognizer? bummer + sys.exit() + self.recognizer.connect('finished',self.recognizer_finished) print "Using Options: ", self.options diff --git a/Recognizer.py b/Recognizer.py index 7bc2023..e9cb648 100755 --- a/Recognizer.py +++ b/Recognizer.py @@ -7,6 +7,7 @@ pygst.require('0.10') import gst import os.path import gobject +import sys #define some global variables this_dir = os.path.dirname( os.path.abspath(__file__) ) @@ -31,6 +32,7 @@ class Recognizer(gobject.GObject): except Exception, e: print e.message print "You may need to install gstreamer0.10-pocketsphinx" + raise e #get the Auto Speech Recognition piece asr=self.pipeline.get_by_name('asr') -- cgit 1.4.1