Error fetching configuration


#1

I was told I could ask this here. Please forgive me if I’m not suppose to.
I am having an issue where I want to tell the user if an option is missing (like the username)… but the username is set in ```settings.json.

Line concerned: https://gitlab.com/HypeWolf/mycroft-nextcloud/blob/master/init.py#L89

I have a function called in init:
def caldavConnect(self):
username = self.settings.get(“username”)
password = self.settings.get(“password”)
protocol = self.settings.get(“protocol”)
url = self.settings.get(“url”)
LOGGER.info(username)

        # FIXME If a parameter is missing, the skill should warn the user and stop.
        if not username:
            LOGGER.error("No username in configuration.")
            self.speak_dialog('err.conf.username')
            return False
        elif not password:
            LOGGER.error("No password in configuration.")
            self.speak_dialog('err.conf.password')
            return False
        elif not url:
            self.speak_dialog('err.conf.url')
            return False

And the stack:
16:14:33.099 - mycroft.skills.core:load_skill:169 - ERROR - Failed to load skill: nextcloud-skill
Traceback (most recent call last):
File “/media/DarkHawk/srv/Github/mycroft-core/mycroft/skills/core.py”, line 135, in load_skill
skill = skill_module.create_skill()
File “/opt/mycroft/skills/nextcloud-skill/init.py”, line 194, in create_skill
return NextcloudSkill()
File “/opt/mycroft/skills/nextcloud-skill/init.py”, line 50, in init
self.caldav_ = self.caldavConnect()
File “/opt/mycroft/skills/nextcloud-skill/init.py”, line 89, in caldavConnect
self.speak_dialog(‘err.conf.username’)
File “/media/DarkHawk/srv/Github/mycroft-core/mycroft/skills/core.py”, line 1439, in speak_dialog
self.speak(self.dialog_renderer.render(key, data),
AttributeError: ‘NoneType’ object has no attribute ‘render’


#2

I heard that Mycroft doesn’t like gitlab and prefer Microsoft. (Wow, open source and choice you say? I’m disappointed, sorry)
The new repo: https://github.com/Extarys/Mycroft-Nextcloud-Skill


#3

Hi SickWolf,

If you shift the settings checks to the initialize method rather than init this should all work as expected, eg:

class NextcloudSkill(MycroftSkill):
    def __init__(self):
        super(NextcloudSkill, self).__init__()

    def initialize(self):
        self.caldav_ = self.caldavConnect()

The reason for this is that init is called as the Skill is loading, whilst initialize waits for the Skill to load, (including registering the intents) before executing.

In terms of Github, we’ve been on the platform since the project started many years ago and well before the Microsoft buyout. It is a significant undertaking to shift to another provider and whilst we are passionate about open source, this just isn’t a high enough priority at the moment. It’s particularly disappointing to see them block an entire country from accessing their own data at the moment.