Mycroft-core: dialog_renderer None if valid dialog directory does not exist

Created on 6 May 2020  ·  2Comments  ·  Source: MycroftAI/mycroft-core

Issue:

If a Skill does not have a valid dialog or locale directory, and attempts to speak some dialog using strings within the Skill eg

self.speak_dialog('say something')

then the method fails as the dialog_renderer has not been assigned:

  File "/home/kris/mycroft-core/mycroft/skills/mycroft_skill/mycroft_skill.py", line 1102, in speak_dialog
    self.speak(self.dialog_renderer.render(key, data),
AttributeError: 'NoneType' object has no attribute 'render'

Creating an empty dialog/en-us/ directory resolves the issue.

Expectation

As the Skill author is not using a dialog string, the expectation is that the directory is not required.

Or could provide a more descriptive error message for this case, as it may also be that they have incorrectly spelled the directory name eg local/en_us

help wanted

Most helpful comment

Easiest would be handling this in the MycroftSkill.speak_dialog() method making it something like

if self.dialog_renderer:
    data = data or {}
    self.speak(self.dialog_renderer.render(key, data),
               expect_response, wait, meta={'dialog': key, 'data': data})
else:
    self.log.warning('Dialog renderer doesn't exist, does the locale/dialog folder exists?')
    self.speak(key, expected_response, wait, {})

All 2 comments

Easiest would be handling this in the MycroftSkill.speak_dialog() method making it something like

if self.dialog_renderer:
    data = data or {}
    self.speak(self.dialog_renderer.render(key, data),
               expect_response, wait, meta={'dialog': key, 'data': data})
else:
    self.log.warning('Dialog renderer doesn't exist, does the locale/dialog folder exists?')
    self.speak(key, expected_response, wait, {})

I'll get it if no one minds

Was this page helpful?
0 / 5 - 0 ratings

Related issues

beemorris picture beemorris  ·  6Comments

Zacki84 picture Zacki84  ·  10Comments

Ahmed-Benj picture Ahmed-Benj  ·  7Comments

fxdgear picture fxdgear  ·  6Comments

tmajibon picture tmajibon  ·  9Comments