Skip to content

Commit

Permalink
Update logging so global voc resources don't appear as errors in the …
Browse files Browse the repository at this point in the history
…log (#126)

Co-authored-by: Daniel McKnight <daniel@neon.ai>
  • Loading branch information
NeonDaniel and Daniel McKnight committed Jun 1, 2022
1 parent b174686 commit 8ce785e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mycroft/skills/mycroft_skill/mycroft_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,9 @@ def voc_match(self, utt, voc_filename, lang=None, exact=False):
if not voc: # Check for vocab in mycroft core resources
voc = resolve_resource_file(join('text', lang,
voc_filename + '.voc'))

if voc:
LOG.info(f"Found global resource: '{voc_filename}'"
f"for lang '{lang}'")
if not voc or not exists(voc):
raise FileNotFoundError(f'Could not find {voc_filename}.voc file')
# load vocab and flatten into a simple list
Expand Down Expand Up @@ -1057,10 +1059,8 @@ def find_resource(self, res_name, res_dirname=None, lang=None):
result = self._find_resource(res_name, lang, res_dirname)
if not result:
# when resource not found try fallback to en-us
LOG.warning(
f"Skill {self.skill_id} resource '{res_name}' for lang '{lang}' not "
f"found"
)
LOG.info(f"Skill {self.skill_id} resource '{res_name}' for lang "
f"'{lang}' not found in skill")
return result

def _find_resource(self, res_name, lang, res_dirname=None):
Expand Down

0 comments on commit 8ce785e

Please sign in to comment.