Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonetype Error: Can´t get weather on German PiCroft Installation #138

Open
Y0ngg4n opened this issue Sep 14, 2020 · 4 comments
Open

Nonetype Error: Can´t get weather on German PiCroft Installation #138

Y0ngg4n opened this issue Sep 14, 2020 · 4 comments

Comments

@Y0ngg4n
Copy link

Y0ngg4n commented Sep 14, 2020

Log output:

 11:18:02.395 | INFO     |  2916 | __main__:handle_wakeword:67 | Wakeword Detected: hey mycroft
Playing WAVE '/home/pi/mycroft-core/mycroft/res/snd/start_listening.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
 11:18:04.890 | INFO     |  2916 | __main__:handle_record_begin:37 | Begin Recording...
 11:18:07.267 | INFO     |  2916 | __main__:handle_record_end:45 | End Recording...
 11:18:08.565 | INFO     |  2916 | __main__:handle_utterance:72 | Utterance: ['wie ist das wetter']
 11:18:08.998 | ERROR    |   698 | WeatherSkill | Error: 'NoneType' object has no attribute 'date'
Traceback (most recent call last):
  File "/opt/mycroft/skills/mycroft-weather.mycroftai/__init__.py", line 440, in handle_current_weather
    report = self.__populate_report(message)
  File "/opt/mycroft/skills/mycroft-weather.mycroftai/__init__.py", line 1274, in __populate_report
    if when.date() == today.date() and when.time() != today.time():
AttributeError: 'NoneType' object has no attribute 'date'
  ^--- NEWEST ---^
@krisgesling
Copy link
Contributor

Hey there, thanks for reporting this bug.

This Skill will soon be largely rewritten but if anyone wants to patch this in the interim, we'll gladly accept a PR.

@Y0ngg4n
Copy link
Author

Y0ngg4n commented Sep 15, 2020

@krisgesling ok thank you for your answer

@junivex
Copy link
Contributor

junivex commented Sep 18, 2020

Hey there, since I also experienced this bug on my German Picroft, I had another look at it.
I was able to trace it back to the function __populate_report, as can already be seen from the log output. This function invokes __extract_datetime("today"), and thereby the mycroft-core function, which returns None, as long as the default language is set to anything else than English (because only the English parser knows the word "today").

If the language is passed together with "today" (lang='en'), the function will return the correct date and time, and the skill works as expected.
Therefore, I changed the function call in __populate_report, and a similar call in __populate_current that raised an error as well.

Although I'm very new to Mycroft and Github, I will try to open a pull request.

@krisgesling
Copy link
Contributor

Thanks for digging into this further @junivex

Let us know if you run into any blockers dealing with Github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants