Comment 3 for bug 1908782

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.