Handle missing noise words file in CQS
This treats a None result from resolve_resource_file() as a FileNotFound exception.pull/3080/head
parent
4791114609
commit
3fa99f288f
|
@ -68,11 +68,15 @@ class CommonQuerySkill(MycroftSkill, ABC):
|
||||||
noise_words_filename = resolve_resource_file(noise_words_filepath)
|
noise_words_filename = resolve_resource_file(noise_words_filepath)
|
||||||
self.translated_noise_words = []
|
self.translated_noise_words = []
|
||||||
try:
|
try:
|
||||||
with open(noise_words_filename) as f:
|
if noise_words_filename:
|
||||||
self.translated_noise_words = f.read().strip()
|
with open(noise_words_filename) as f:
|
||||||
self.translated_noise_words = self.translated_noise_words.split()
|
read_noise_words = f.read().strip()
|
||||||
|
self.translated_noise_words = read_noise_words.split()
|
||||||
|
else:
|
||||||
|
raise FileNotFoundError
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
self.log.warning("Missing noise_words.list file in res/text/lang")
|
self.log.warning("Missing noise_words.list file in "
|
||||||
|
f"res/text/{self.lang}")
|
||||||
|
|
||||||
# these should probably be configurable
|
# these should probably be configurable
|
||||||
self.level_confidence = {
|
self.level_confidence = {
|
||||||
|
|
Loading…
Reference in New Issue