# Buggy code
def run(self):
    """Load skills and update periodically from disk and internet."""
    self._remove_git_locks()
    self._connected_event.wait()
    if (
        not self.skill_updater.defaults_installed()
        and self.skills_config["auto_update"]
    ):
        LOG.info("Not all default skills are installed, performing skill update...")
        self.skill_updater.update_skills()
    self._load_on_startup()

    # Sync backend and skills.
    if is_paired() and not self.upload_queue.started:
        self._start_settings_update()

    # Scan the file folder that contains Skills.  If a Skill is updated,
    # unload the existing version from memory and reload from the disk.
    while not self._stop_event.is_set():
        try:
            self._reload_modified_skills()
            self._load_new_skills()
            self._unload_removed_skills()
            self._update_skills()
            if is_paired() and self.upload_queue.started and len(self.upload_queue) > 0:
                self.msm.clear_cache()
                self.skill_updater.post_manifest()
                self.upload_queue.send()

            self._watchdog()
            sleep(2)  # Pause briefly before beginning next scan
        except Exception:
            LOG.exception(
                "Something really unexpected has occured "
                "and the skill manager loop safety harness was "
                "hit."
            )
            sleep(30)


# Traceback (FileNotFoundError)
2021-02-04 11:35:41.063 | ERROR    | 20080 | mycroft.skills.skill_manager:run:260 | Something really unexpected has occured and the skill manager loop safety harness was hit.
Traceback (most recent call last):
File "/home/gez/mycroft-core/mycroft/skills/skill_manager.py", line 248, in run
self._load_new_skills()
File "/home/gez/mycroft-core/mycroft/skills/skill_manager.py", line 296, in _load_new_skills
for skill_dir in self._get_skill_directories():
File "/home/gez/mycroft-core/mycroft/skills/skill_manager.py", line 322, in _get_skill_directories
if SKILL_MAIN_MODULE in os.listdir(skill_dir):
FileNotFoundError: [Errno 2] No such file or directory: '/home/gez/.local/share/mycroft/skills/youtube-music-skill.forslund/'
2021-02-04 11:36:11.184 | INFO     | 20080 | mycroft.skills.skill_manager:_unload_removed_skills:338 | removing youtube-music-skill.forslund

# Fixed code
def run(self):
    """Load skills and update periodically from disk and internet."""
    self._remove_git_locks()
    self._connected_event.wait()
    if (
        not self.skill_updater.defaults_installed()
        and self.skills_config["auto_update"]
    ):
        LOG.info("Not all default skills are installed, performing skill update...")
        self.skill_updater.update_skills()
    self._load_on_startup()

    # Sync backend and skills.
    if is_paired() and not self.upload_queue.started:
        self._start_settings_update()

    # Scan the file folder that contains Skills.  If a Skill is updated,
    # unload the existing version from memory and reload from the disk.
    while not self._stop_event.is_set():
        try:
            self._unload_removed_skills()
            self._reload_modified_skills()
            self._load_new_skills()
            self._update_skills()
            if is_paired() and self.upload_queue.started and len(self.upload_queue) > 0:
                self.msm.clear_cache()
                self.skill_updater.post_manifest()
                self.upload_queue.send()

            self._watchdog()
            sleep(2)  # Pause briefly before beginning next scan
        except Exception:
            LOG.exception(
                "Something really unexpected has occured "
                "and the skill manager loop safety harness was "
                "hit."
            )
            sleep(30)