Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

ensure load_status is initialized on load failure #2735

Merged
merged 1 commit into from
Oct 26, 2020
Merged

Conversation

krisgesling
Copy link
Contributor

Description

Issue reported by Jarbas on Chat:

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/mycroft/mycroft-core/mycroft/skills/skill_manager.py", line 234, in run
    self._load_on_startup()
  File "/home/mycroft/mycroft-core/mycroft/skills/skill_manager.py", line 271, in _load_on_startup
    self._load_new_skills()
  File "/home/mycroft/mycroft-core/mycroft/skills/skill_manager.py", line 293, in _load_new_skills
    loader = self._load_skill(skill_dir)
  File "/home/mycroft/mycroft-core/mycroft/skills/skill_manager.py", line 306, in _load_skill
    return skill_loader if load_status else None
UnboundLocalError: local variable 'load_status' referenced before assignment

If the load fails, we catch the exception but don't initialize the load_status variable that we then use in a conditional to determine the return value. This sets load_status to False if loading fails which will cause the function to return None.

How to test

Somehow cause a load failure?

Contributor license agreement signed?

@krisgesling krisgesling added the Type: Bug - quick Bug fixes that are quick to review and the implications of the change are clear and contained. label Oct 26, 2020
@devops-mycroft devops-mycroft added the CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) label Oct 26, 2020
Copy link
Collaborator

@forslund forslund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch of Jarbas and nice fix

@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

@forslund forslund merged commit 73e4994 into dev Oct 26, 2020
@krisgesling krisgesling deleted the bugfix/load-status branch October 26, 2020 07:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) Type: Bug - quick Bug fixes that are quick to review and the implications of the change are clear and contained.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants