skill-weather
skill-weather copied to clipboard
Nonetype Error: Can´t get weather on German PiCroft Installation
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 ---^
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.
@krisgesling ok thank you for your answer
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.
Thanks for digging into this further @junivex
Let us know if you run into any blockers dealing with Github