Error 616

Bug #1908782 reported by Dan Watson
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
my-weather-indicator
New
Undecided
Unassigned

Bug Description

<gettext.GNUTranslations object at 0x7fd3c5905048>
#####################################################
System: Linux
Machine: x86_64
Node: dan-Latitude-E6510
Release: 5.4.0-58-generic
Version: #64~18.04.1-Ubuntu SMP Wed Dec 9 17:11:11 UTC 2020
Platform: Linux-5.4.0-58-generic-x86_64-with-Peppermint-10-bionic
My-Weather-Indicator version: 0.9.5-0extras20.04.09
#####################################################

My-Weather-Indicator version: 0.9.5-0extras20.04.09
#####################################################
****** Requesting timezone identificacion
** OWM **
4985601 -83.4852106 42.2048414
****** Requesting timezone identificacion
** OWM **
5398563 -122.1651998 37.4434703
1
***** refreshing weather *****
OK. Internet connection. HTTPConnection: www.google.com
--- Updating data in location 0 ---
****** Updating weather
****** Calculating rawOffset
-------------------------------------------------------
OpenWeatherMap Weather Service url:http://api.openweathermap.org/data/2.5/weather?id=4985601&appid=4516154e5c8a6494e7e13b550408c863
-------------------------------------------------------
Traceback (most recent call last):
  File "/opt/extras.ubuntu.com/my-weather-indicator/bin/my-weather-indicator", line 36, in <module>
    main()
  File "/opt/extras.ubuntu.com/my-weather-indicator/share/my-weather-indicator/myweatherindicator.py", line 956, in main
    MWI()
  File "/opt/extras.ubuntu.com/my-weather-indicator/share/my-weather-indicator/myweatherindicator.py", line 126, in __init__
    self.load_preferences()
  File "/opt/extras.ubuntu.com/my-weather-indicator/share/my-weather-indicator/myweatherindicator.py", line 352, in load_preferences
    self.update_weather()
  File "/opt/extras.ubuntu.com/my-weather-indicator/share/my-weather-indicator/myweatherindicator.py", line 141, in update_weather
    self.update_menu(i)
  File "/opt/extras.ubuntu.com/my-weather-indicator/share/my-weather-indicator/myweatherindicator.py", line 669, in update_menu
    weather = self.weatherservices[index].get_weather()
  File "/opt/extras.ubuntu.com/my-weather-indicator/share/my-weather-indicator/wopenweathermapapi.py", line 263, in get_weather
    condition = CONDITION[data['weather'][0]['id']]
KeyError: 616

Revision history for this message
Carottinger (carottinger) wrote :

Full reinstall did not help either

Revision history for this message
Carottinger (carottinger) wrote :

Looks like "weather" data is no longer available from google API in right format

Revision history for this message
Kris Johnson (krisj) wrote :

I "fixed" this by editing /opt/extras.ubuntu.com/my-weather-indicator/share/my-weather-indicator/wopenweathermapapi.py line 263 so that it no longer crashes if the downloaded weather condition is not a known one.

Was:
    condition = CONDITION[data['weather'][0]['id']]

Changed to:
    if data['weather'][0]['id'] not in CONDITION.keys():
        condition = 'not available'
    else:
        condition = CONDITION[data['weather'][0]['id']]

You could probably alternatively fix this by adding the missing condition to the list of condition strings (found between lines 44 and 92) by clicking on the "OpenWeatherMap Weather Service url" (eg, in your case http://api.openweathermap.org/data/2.5/weather?id=4985601&appid=4516154e5c8a6494e7e13b550408c863) and looking for the "id" of the first "weather" element and ensuring that there is a corresponding CONDITION entry for that id which reflects the weather condition.

Revision history for this message
Radu Axente (radax05) wrote :

@Kris Johnson (krisj): Thank you for the fix with the "if... else..." clause. It works!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.