Merge pull request #60 from MycroftAI/bugfix/issues-18

Bugfix/issues 18
pull/65/head release/v0.6.2
aatchison 2016-05-27 12:02:27 -05:00
commit 7322539d82
11 changed files with 23 additions and 12 deletions

View File

@ -302,5 +302,6 @@ class RecognizerLoop(pyee.EventEmitter):
while self.state.running: while self.state.running:
try: try:
time.sleep(1) time.sleep(1)
except KeyboardInterrupt: except KeyboardInterrupt as e:
logger.error(e)
self.stop() self.stop()

View File

@ -19,7 +19,7 @@
import time import time
import os import os
from pocketsphinx.pocketsphinx import * from pocketsphinx.pocketsphinx import Decoder
__author__ = 'seanfitz, jdorleans' __author__ = 'seanfitz, jdorleans'

View File

@ -109,6 +109,7 @@ def main():
try: try:
loop.run() loop.run()
except KeyboardInterrupt, e: except KeyboardInterrupt, e:
logger.exception(e)
event_thread.exit() event_thread.exit()
sys.exit() sys.exit()

View File

@ -62,6 +62,7 @@ def main():
Message("recognizer_loop:utterance", Message("recognizer_loop:utterance",
metadata={'utterances': [line.strip()]})) metadata={'utterances': [line.strip()]}))
except KeyboardInterrupt, e: except KeyboardInterrupt, e:
logger.exception(e)
event_thread.exit() event_thread.exit()
sys.exit() sys.exit()

View File

@ -15,9 +15,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>. # along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
import tornado.ioloop as ioloop
import tornado.ioloop import tornado.web as web
import tornado.web
from mycroft.messagebus.service.ws import WebsocketEventHandler from mycroft.messagebus.service.ws import WebsocketEventHandler
from mycroft.configuration.config import ConfigurationManager from mycroft.configuration.config import ConfigurationManager
@ -40,11 +39,11 @@ def main():
(service_config.get('route'), WebsocketEventHandler) (service_config.get('route'), WebsocketEventHandler)
] ]
application = tornado.web.Application(routes, **settings) application = web.Application(routes, **settings)
application.listen(service_config.get("port"), service_config.get("host")) application.listen(service_config.get("port"), service_config.get("host"))
ioloop = tornado.ioloop.IOLoop.instance() loop = ioloop.IOLoop.instance()
ioloop.start() loop.start()
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -54,6 +54,7 @@ class WebsocketEventHandler(tornado.websocket.WebSocketHandler):
self.emitter.emit( self.emitter.emit(
deserialized_message.message_type, deserialized_message) deserialized_message.message_type, deserialized_message)
except Exception, e: except Exception, e:
logger.exception(e)
traceback.print_exc(file=sys.stdout) traceback.print_exc(file=sys.stdout)
pass pass

View File

@ -19,9 +19,12 @@
from adapt.engine import IntentDeterminationEngine from adapt.engine import IntentDeterminationEngine
from mycroft.messagebus.message import Message from mycroft.messagebus.message import Message
from mycroft.skills.core import open_intent_envelope, MycroftSkill from mycroft.skills.core import open_intent_envelope, MycroftSkill
from mycroft.util.log import getLogger
__author__ = 'seanfitz' __author__ = 'seanfitz'
logger = getLogger(__name__)
class IntentSkill(MycroftSkill): class IntentSkill(MycroftSkill):
def __init__(self): def __init__(self):
@ -45,6 +48,7 @@ class IntentSkill(MycroftSkill):
# TODO - Should Adapt handle this? # TODO - Should Adapt handle this?
best_intent['utterance'] = utterance best_intent['utterance'] = utterance
except StopIteration, e: except StopIteration, e:
logger.exception(e)
continue continue
if best_intent and best_intent.get('confidence', 0.0) > 0.0: if best_intent and best_intent.get('confidence', 0.0) > 0.0:

View File

@ -71,8 +71,8 @@ class OWM25(owm.OWM):
def _assert_is_string(name, value): def _assert_is_string(name, value):
try: try:
# Python 2.x # Python 2.x
assert(isinstance(value, basestring), assert isinstance(value, basestring), \
"'%s' must be a str" % (name,)) ("'%s' must be a str" % (name,))
except NameError: except NameError:
# Python 3.x # Python 3.x
assert isinstance(value, str), "'%s' must be a str" % (name,) assert isinstance(value, str), "'%s' must be a str" % (name,)

View File

@ -131,6 +131,7 @@ class WolframAlphaSkill(MycroftSkill):
self.speak_dialog('not.paired') self.speak_dialog('not.paired')
return return
except Exception as e: except Exception as e:
logger.exception(e)
self.speak("Sorry, I don't understand your request.") self.speak("Sorry, I don't understand your request.")
return return

View File

@ -20,11 +20,13 @@ import os
import subprocess import subprocess
from setuptools import find_packages from setuptools import find_packages
import shutil import shutil
from mycroft.util.log import getLogger
__author__ = 'seanfitz' __author__ = 'seanfitz'
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) BASEDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
logger = getLogger(__name__)
def place_manifest(manifest_file): def place_manifest(manifest_file):
@ -36,12 +38,14 @@ def get_version():
try: try:
import mycroft.__version__ import mycroft.__version__
version = mycroft.__version__.version version = mycroft.__version__.version
except Exception, e: except Exception as e:
try: try:
version = "dev-" + subprocess.check_output( version = "dev-" + subprocess.check_output(
["git", "rev-parse", "--short", "HEAD"]).strip() ["git", "rev-parse", "--short", "HEAD"]).strip()
except subprocess.CalledProcessError, e2: except subprocess.CalledProcessError, e2:
version = "development" version = "development"
logger.debug(e)
logger.exception(e2)
return version return version

View File

@ -1,5 +1,4 @@
import json import json
import unittest
from pyee import EventEmitter from pyee import EventEmitter
from mycroft.messagebus.message import Message from mycroft.messagebus.message import Message
from mycroft.skills.core import load_skills from mycroft.skills.core import load_skills