diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-09 12:09:35 -0400 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-09 12:13:30 -0400 |
| commit | cfaf0921e84d491d74659eefdf7a329597fbf334 (patch) | |
| tree | 6898d2779c4e3d5b6bef9f2aef701dfe362f653f /boot/boot.py | |
| parent | fdc7e71bc3e1315b6785177806deca4db92c9023 (diff) | |
| download | jasper-client-cfaf0921e84d491d74659eefdf7a329597fbf334.tar.gz jasper-client-cfaf0921e84d491d74659eefdf7a329597fbf334.zip | |
Better error message granularity in boot.py
Diffstat (limited to 'boot/boot.py')
| -rwxr-xr-x | boot/boot.py | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/boot/boot.py b/boot/boot.py index a8141cb..bc36bbe 100755 --- a/boot/boot.py +++ b/boot/boot.py @@ -13,21 +13,43 @@ sys.path.append(lib_path) import speaker as speak speaker = speak.newSpeaker() + +def fail(message): + traceback.print_exc() + speaker.say(message) + + def configure(): try: urllib2.urlopen("http://www.google.com").getcode() print "CONNECTED TO INTERNET" print "COMPILING DICTIONARY" - vocabcompiler.compile("../client/sentences.txt", "../client/dictionary.dic", "../client/languagemodel.lm") + vocabcompiler.compile( + "../client/sentences.txt", "../client/dictionary.dic", "../client/languagemodel.lm") print "STARTING CLIENT PROGRAM" os.system("$JASPER_HOME/jasper/client/start.sh &") - except: + except urllib2.URLError: print "COULD NOT CONNECT TO NETWORK" - traceback.print_exc() - speaker.say("Hello, I could not connect to a network. Please read the documentation to configure your Raspberry Pi.") + fail( + "I could not connect to a network. Please read the documentation to configure your Raspberry Pi.") + + except OSError: + print "BOOT FAILURE: OSERROR" + fail( + "There was a problem starting Jasper. You may be missing the language model and associated files. Please read the documentation to configure your Raspberry Pi.") + + except IOError: + print "BOOT FAILURE: IOERROR" + fail( + "There was a problem starting Jasper. You may have set permissions incorrectly on some part of the filesystem. Please read the documentation to configure your Raspberry Pi.") + + except: + print "BOOT FAILURE" + fail( + "There was a problem starting Jasper. Please read the documentation to configure your Raspberry Pi.") if __name__ == "__main__": print "==========STARTING JASPER CLIENT==========" |
