Handle missing noise words file in CQS
This treats a None result from resolve_resource_file() as a FileNotFound
exception.
@@ -68,11 +68,15 @@ class CommonQuerySkill(MycroftSkill, ABC):
noise_words_filename = resolve_resource_file(noise_words_filepath)
self.translated_noise_words = []
try:
+ if noise_words_filename:
with open(noise_words_filename) as f:
- self.translated_noise_words = f.read().strip()
- 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:
- 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
self.level_confidence = {
