From 52a30cae6fb11ceedfaa9cb252432a2801a2de6f Mon Sep 17 00:00:00 2001 From: schneefux Date: Thu, 11 Sep 2014 14:05:57 +0200 Subject: Moved all imports to the top and changed `--local` detection --- jasper.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/jasper.py b/jasper.py index 7e84cd2..a04216d 100755 --- a/jasper.py +++ b/jasper.py @@ -7,6 +7,14 @@ import traceback import shutil import yaml +from client import vocabcompiler, stt +from client import speaker as speak +from client.conversation import Conversation +if len(sys.argv) > 1 and "--local" in sys.argv[1:]: + from client.local_mic import Mic +else: + from client.mic import Mic + # Set $JASPER_HOME jasper_home = os.getenv("JASPER_HOME") if not jasper_home or not os.path.exists(jasper_home): @@ -34,8 +42,6 @@ else: path = "/usr/local/lib/" os.environ["PATH"] = path -from client import vocabcompiler -from client import speaker as speak speaker = speak.newSpeaker() def testConnection(): @@ -79,17 +85,6 @@ old_client = os.path.abspath(os.path.join(os.pardir, "old_client")) if os.path.exists(old_client): shutil.rmtree(old_client) -from client import stt -from client.conversation import Conversation - -def isLocal(): - return len(sys.argv) > 1 and sys.argv[1] == "--local" - -if isLocal(): - from client.local_mic import Mic -else: - from client.mic import Mic - if __name__ == "__main__": print "===========================================================" -- cgit v1.3.1