Picroft - bug in skills/main.py - 3rd party skills won't load


#1

Installed picroft working to the point where audio input and output is working. Wakeword is detected. Installed demo skill and daily mediation skill using “msm”, mycroft just says:

SpeechClient - INFO - Speak: Sorry, I don’t understand the phrase daily meditation
SpeechClient - INFO - Speak: Sorry, I don’t understand the phrase play some music

Is there a way I can see loaded skills?
Does there need to be an entry in /etc/mycroft/mycroft.conf for them? If so why doesn’t “msm” do that for me?

How can I debug this?

UPDATE: There seems to be a bug in main.py, changed “client” to “ws” and now 3rd party skills load.
Please tell me why this code seems so divergent from the one out on GitHub?

***** NOTICED ERROR IN LOG WHEN TRYING TO RUN 3rd PARTY SKILL ******

2017-06-23 15:45:37,375 - root - ERROR - global name ‘client’ is not defined
File “/usr/local/lib/python2.7/site-packages/websocket/_app.py”, line 231, in _callback
callback(self, *args)
File “/usr/local/lib/python2.7/site-packages/mycroft_core-0.8.1-py2.7.egg/mycroft/messagebus/client/ws.py”, line 62, in on_open
self.emitter.emit(“open”)
File “/usr/local/lib/python2.7/site-packages/pyee/init.py”, line 113, in emit
f(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/pyee/init.py”, line 127, in g
f(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/mycroft_core-0.8.1-py2.7.egg/mycroft/skills/main.py”, line 46, in load_skills_callback
load_skills(client, loc)

************* WHERE IS client defined HERE ??? ********
import json
from os.path import expanduser, exists

from mycroft.configuration import ConfigurationManager
from mycroft.messagebus.client.ws import WebsocketClient
from mycroft.skills.core import load_skills, THIRD_PARTY_SKILLS_DIR
from mycroft.util.log import getLogger

logger = getLogger(“Skills”)

author = ‘seanfitz’

ws = None

def load_skills_callback():
global ws
load_skills(ws)
config = ConfigurationManager.get().get(“skills”)

try:
    ini_third_party_skills_dir = expanduser(config.get("directory"))
except AttributeError as e:
    logger.warning(e.message)

for loc in THIRD_PARTY_SKILLS_DIR:
    if exists(loc):
        load_skills(client, loc)         <<---!!!!!! client is no defined anywhere

*** POTENTIAL PROBLEM IN LOG *****

2017-06-23 15:09:11,841 - Skills - DEBUG - {“type”: “recognizer_loop:record_end”, “data”: {}, “context”: null}
2017-06-23 15:09:11,850 - Skills - DEBUG - {“type”: “recognizer_loop:wakeword”, “data”: {“session”: “d3cef0e5-2060-4bc6-898e-aa57b36d8d38”, “utterance”: “hey mycroft”}, “context”: null}
2017-06-23 15:09:14,206 - Skills - DEBUG - {“type”: “recognizer_loop:utterance”, “data”: {“session”: “d3cef0e5-2060-4bc6-898e-aa57b36d8d38”, “utterances”: [“ping google”]}, “context”: null}
2017-06-23 15:09:14,231 - intent__init__ - ERROR -
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/mycroft_core-0.8.1-py2.7.egg/mycroft/skills/intent/init.py”, line 48, in handle_utterance
utterance, 100))
StopIteration
2017-06-23 15:09:14,240 - Skills - DEBUG - {“type”: “intent_failure”, “data”: {“utterance”: “ping google”}, “context”: null}
2017-06-23 15:09:14,243 - wolfram_alpha__init__ - DEBUG - Could not determine intent, falling back to WolframAlpha Skill!
2017-06-23 15:09:14,255 - Skills - DEBUG - {“type”: “enclosure.mouth.think”, “data”: {}, “context”: null}
2017-06-23 15:09:14,258 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai
2017-06-23 15:09:14,716 - requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 “GET /v1/wa?input=ping+google HTTP/1.1” 200 417
/usr/local/lib/python2.7/site-packages/wolframalpha/init.py:15: FutureWarning: The behavior of this method will change in future versions. Use specific ‘len(elem)’ or ‘elem is not None’ test instead.
if not error:
2017-06-23 15:09:14,744 - wolfram_alpha__init__ - ERROR - Error 1: Invalid appid
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/mycroft_core-0.8.1-py2.7.egg/mycroft/skills/wolfram_alpha/init.py”, line 147, in handle_fallback
res = self.client.query(query)
File “/usr/local/lib/python2.7/site-packages/mycroft_core-0.8.1-py2.7.egg/mycroft/skills/wolfram_alpha/init.py”, line 84, in query
return wolframalpha.Result(StringIO(data.content))
File “/usr/local/lib/python2.7/site-packages/wolframalpha/init.py”, line 11, in init
self._handle_error()
File “/usr/local/lib/python2.7/site-packages/wolframalpha/init.py”, line 21, in _handle_error
raise Exception(tmpl.format(code=code, msg=msg))
Exception: Error 1: Invalid appid

*** RELEVANT LOG ENTRIES MAYBE ****

2017-06-23 14:25:12,883 - Skills - DEBUG - {“type”: “intent_failure”, “data”: {“utterance”: “play some music”}, “context”: null}
2017-06-23 14:25:12,885 - wolfram_alpha__init__ - DEBUG - Could not determine intent, falling back to WolframAlpha Skill!
2017-06-23 14:25:12,899 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai
2017-06-23 14:25:12,900 - Skills - DEBUG - {“type”: “enclosure.mouth.think”, “data”: {}, “context”: null}
2017-06-23 14:25:13,298 - requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 “GET /v1/wa?input=play+some+music HTTP/1.1” 200 416
/usr/local/lib/python2.7/site-packages/wolframalpha/init.py:15: FutureWarning: The behavior of this method will change in future versions. Use specific ‘len(elem)’ or ‘elem is not None’ test instead.
if not error:
2017-06-23 14:25:13,326 - wolfram_alpha__init__ - ERROR - Error 1: Invalid appid
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/mycroft_core-0.8.1-py2.7.egg/mycroft/skills/wolfram_alpha/init.py”, line 147, in handle_fallback
res = self.client.query(query)
File “/usr/local/lib/python2.7/site-packages/mycroft_core-0.8.1-py2.7.egg/mycroft/skills/wolfram_alpha/init.py”, line 84, in query
return wolframalpha.Result(StringIO(data.content))
File “/usr/local/lib/python2.7/site-packages/wolframalpha/init.py”, line 11, in init
self._handle_error()
File “/usr/local/lib/python2.7/site-packages/wolframalpha/init.py”, line 21, in _handle_error
raise Exception(tmpl.format(code=code, msg=msg))
Exception: Error 1: Invalid appid

2017-06-23 14:27:36,141 - Skills - DEBUG - {“type”: “intent_failure”, “data”: {“utterance”: “meditation”}, “context”: null}
2017-06-23 14:27:36,144 - wolfram_alpha__init__ - DEBUG - Could not determine intent, falling back to WolframAlpha Skill!
2017-06-23 14:27:36,157 - Skills - DEBUG - {“type”: “enclosure.mouth.think”, “data”: {}, “context”: null}
2017-06-23 14:27:36,159 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai
2017-06-23 14:27:36,580 - requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 “GET /v1/wa?input=meditation HTTP/1.1” 200 416
2017-06-23 14:27:36,607 - wolfram_alpha__init__ - ERROR - Error 1: Invalid appid
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/mycroft_core-0.8.1-py2.7.egg/mycroft/skills/wolfram_alpha/init.py”, line 147, in handle_fallback
res = self.client.query(query)
File “/usr/local/lib/python2.7/site-packages/mycroft_core-0.8.1-py2.7.egg/mycroft/skills/wolfram_alpha/init.py”, line 84, in query
return wolframalpha.Result(StringIO(data.content))
File “/usr/local/lib/python2.7/site-packages/wolframalpha/init.py”, line 11, in init
self._handle_error()
File “/usr/local/lib/python2.7/site-packages/wolframalpha/init.py”, line 21, in _handle_error
raise Exception(tmpl.format(code=code, msg=msg))
Exception: Error 1: Invalid appid
2017-06-23 14:27:36,617 - Skills - DEBUG - {“type”: “speak”, “data”: {“utterance”: “Sorry, I don’t understand the phrase meditation”}, “context”: null}


#2

What is the path to the main.py file?


#3

skills/main.py problem is obvious:

load_skills(client, loc) ---- client is not defined anywhere


#4

can you take it down to noob level and explain how you fixed it. I am having the same issue.


#5

ok i figured it out but am now getting

2017-07-13 17:38:04,531 - mycroft.messagebus.client.ws - ERROR - Exception(“Unca ught ‘error’ event.”,)
2017-07-13 17:40:30,657 - intent__init__ - ERROR -
2017-07-13 17:40:51,846 - intent__init__ - ERROR -


#6

Using the picroft IMG the only change I had to make was to:

skills/main.py change the parameter reference “client” to “ws”.

***** CODE HERE ****

def load_skills_callback():
global ws
global skills
skills += load_skills(ws)
config = ConfigurationManager.get().get(“skills”)

try:
    ini_third_party_skills_dir = expanduser(config.get("directory"))
except AttributeError as e:
    logger.warning(e.message)

for loc in THIRD_PARTY_SKILLS_DIR:
    if exists(loc):
        skills += load_skills(ws, loc)               <<--- was client

if ini_third_party_skills_dir and exists(ini_third_party_skills_dir):
    skills += load_skills(ws, ini_third_party_skills_dir)

#7

i copied what you have and got this?

2017-07-13 18:58:59,227 - mycroft.messagebus.client.ws - ERROR - Exception(“Uncaught ‘error’ event.”,)
2017-07-13 18:59:04,240 - root - ERROR - global name ‘skills’ is not defined

where did you define skills? any ideas about the other?


#8

Chris,
I am no longer developing with MyCroft I’d have to dig out my PI. I am sure others can help and I think that is pretty well documented. I even think there is a script to download and install pre-built ones so you can test that they will load. Then you go and develop your own.