indicator-weather on Quantal throws exception when adding location

Bug #1100680 reported by Mike McClurg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Indicator-weather
New
Undecided
Unassigned

Bug Description

I just installed the weather indicator and tried to set up a location. The location I've tried to set up was "Cambridge, England," but other locations didn't work either. When I set up a location, the GUI allows me to proceed through the entire wizard process. After I press the "Apply" button, nothing happens in the GUI, but I get a stack trace on the CLI:

/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
  import gobject._gobject
Traceback (most recent call last):
  File "/usr/bin/indicator-weather", line 1892, in on_apply
    (location_code, location_details) = self.location.export_location_details()
  File "/usr/bin/indicator-weather", line 405, in export_location_details
    return (self.location_code, self.location_details)
AttributeError: Location instance has no attribute 'location_code'

Python 2.7.3
indicator-weather version: 12.07.30-0ubuntu1

Revision history for this message
Mike McClurg (mike-mcclurg) wrote :

I just found the debug log for this app. Here is a snippet from the log immediately after I search for, and then select, "Cambridge, England":

[MainThread] 2013-01-17 09:03:49,583 - DEBUG - Assistant: looking for location 'Cambridge, England'
[MainThread] 2013-01-17 09:03:52,179 - DEBUG - Assistant: moved to page 0
[MainThread] 2013-01-17 09:03:52,179 - DEBUG - Assistant: Page 0: got location with code 2653941
[MainThread] 2013-01-17 09:03:52,180 - DEBUG - Location: Get GeoNames location details, url http://api.geonames.org/getJSON?geonameId=2653941&username=indicatorweather
[MainThread] 2013-01-17 09:03:52,446 - DEBUG - Location: Get Yahoo WOEID, url http://where.yahooapis.com/geocode?flags=J&location=Cambridge%2C+England%2C+United+Kingdom&appid=mOawLd4s
[MainThread] 2013-01-17 09:03:52,817 - ERROR - Location: Yahoo woeid return error. Full response:
 {'@lang': 'en-US', 'ResultSet': {'@lang': 'en-US', 'Error': '0', 'Locale': 'en-US', 'Found': '1', 'ErrorMessage': 'No error', '@version': '2.0', 'Quality': '40', 'Results': [{'neighborhood': '', 'house': '', 'county': 'Cambridgeshire', 'street': '', 'radius': '7200', 'quality': '40', 'unit': '', 'city': 'Cambridge', 'countrycode': 'GB', 'woeid': '14979', 'xstreet': '', 'line4': 'United Kingdom', 'line3': '', 'line2': 'Cambridge', 'line1': '', 'state': 'England', 'latitude': '52.209801', 'hash': '', 'unittype': '', 'offsetlat': '52.209801', 'statecode': 'ENG', 'postal': '', 'name': '', 'uzip': 'CB3 9', 'country': 'United Kingdom', 'longitude': '0.11147', 'countycode': 'CAM', 'offsetlon': '0.11147', 'woetype': '7'}]}}
[MainThread] 2013-01-17 09:03:52,817 - ERROR - Assistant: Page 0: City with code Cambridge, England, United Kingdom was NOT found

So it seems that the Yahoo! service API has changed, and this app is expecting a key that isn't being returned anymore?

description: updated
description: updated
Revision history for this message
Mike McClurg (mike-mcclurg) wrote :

The bug is at indicator-weather:367. We check that the error code is not equalt to integer 0, but we should be checking string '0'. Maybe this is a problem with a newer version of Python? I'm only running 2.7.3, so I wouldn't have thought so. Here is the line in question:

  if (yahoo_woeid_result['ResultSet']['Error'] != 0) and (yahoo_woeid_result['ResultSet']['Results'] != None):

And the problem is with: yahoo_woeid_result['ResultSet']['Error'] != 0 . The solution is to cast the error code to an int before comparing it to 0. I'll attach a debdiff soon.

Revision history for this message
Mike McClurg (mike-mcclurg) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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