Empty menu and no data

Bug #1012130 reported by Ilis
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Weather Indicator
New
Undecided
Unassigned

Bug Description

No data shown by indicator at all
(see attachment)

indicator-weather: 11.11.28-0ubuntu1
DistroRelease: Ubuntu 12.04
IndicatorLog:
 [Dummy-2] 2012-06-12 19:10:31,716 - DEBUG - SingleInstance: deleting /tmp/indicator-weather-1001.pid
 [MainThread] 2012-06-12 19:10:39,295 - INFO - ------------------------------
 [MainThread] 2012-06-12 19:10:39,296 - INFO - Started Weather Indicator from /usr
 [MainThread] 2012-06-12 19:10:39,296 - INFO - Weather Indicator version 11.11.28 'Cloudy 9'
 [MainThread] 2012-06-12 19:10:39,297 - DEBUG - SingleInstance: writing new pid 26977
 [MainThread] 2012-06-12 19:10:39,321 - DEBUG - ProxyMonitor: loading gconf settings
 [MainThread] 2012-06-12 19:10:39,322 - DEBUG - ProxyMonitor: using direct connection
 [MainThread] 2012-06-12 19:10:39,325 - DEBUG - TimeFormatter: loading indicator-datetime settings: com.canonical.indicator.datetime
 [MainThread] 2012-06-12 19:10:39,327 - DEBUG - Time Formatter: time format changed
 [MainThread] 2012-06-12 19:10:39,330 - DEBUG - Indicator: creating
 [MainThread] 2012-06-12 19:10:39,358 - INFO - Monitoring UPower interface
 [MainThread] 2012-06-12 19:10:39,359 - DEBUG - Indicator: reading settings
 [MainThread] 2012-06-12 19:10:39,360 - DEBUG - Settings: preparing settings store
 [MainThread] 2012-06-12 19:10:39,361 - DEBUG - Settings: getting value for refresh_rate
 [MainThread] 2012-06-12 19:10:39,362 - DEBUG - Settings: getting value for unit
 [MainThread] 2012-06-12 19:10:39,365 - DEBUG - Settings: getting value for notif
 [MainThread] 2012-06-12 19:10:39,366 - DEBUG - Settings: getting value for wind
 [MainThread] 2012-06-12 19:10:39,367 - DEBUG - Settings: getting value for data_source
 [MainThread] 2012-06-12 19:10:39,368 - DEBUG - Settings: getting value for placechosen
 [MainThread] 2012-06-12 19:10:39,369 - DEBUG - Settings: getting value for places
 [MainThread] 2012-06-12 19:10:39,370 - DEBUG - Settings: getting value for show_label
 [MainThread] 2012-06-12 19:10:39,371 - DEBUG - Preferences: got settings: rate=15, unit=S, notif=N, wind=mps, placechosen=0, places=[['2112237', '\xd0\x95\xd0\xba\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd0\xb8\xd0\xbd\xd0\xb1\xd1\x83\xd1\x80\xd0\xb3']]
 [MainThread] 2012-06-12 19:10:39,374 - DEBUG - Indicator: menu_normal: filling in a menu for found places
 [MainThread] 2012-06-12 19:10:39,399 - DEBUG - Indicator: update_label: setting label to ' '
 [MainThread] 2012-06-12 19:10:39,400 - DEBUG - Indicator: updateWeather: updating weather for ['2112237', '\xd0\x95\xd0\xba\xd0\xb0\xd1\x82\xd0\xb5\xd1\x80\xd0\xb8\xd0\xbd\xd0\xb1\xd1\x83\xd1\x80\xd0\xb3']
 [Cache] 2012-06-12 19:10:39,401 - DEBUG - Settings: getting cached weather for 2112237
 [Cache] 2012-06-12 19:10:39,403 - DEBUG - Settings: can't find value for 2112237
 [Fetcher] 2012-06-12 19:10:39,404 - DEBUG - Indicator: getWeather for location 'Екатеринбург, Свердловская область, Россия'
 [Fetcher] 2012-06-12 19:10:39,405 - DEBUG - Indicator: getWeather: updating weather report
 [Fetcher] 2012-06-12 19:10:39,405 - DEBUG - Location: default weather source 'Yahoo' chosen for 'Екатеринбург'
 [Fetcher] 2012-06-12 19:10:39,843 - DEBUG - Weather: current condition: '34', '('weather-clear', 'weather-clear-night', False, '\xd0\xaf\xd1\x81\xd0\xbd\xd0\xbe')'
 [Fetcher] 2012-06-12 19:11:42,948 - ERROR - Weather: error reaching url 'http://www.earthtools.org/timezone-1.1/56.8575/60.6125'
 [Fetcher] 2012-06-12 19:11:42,949 - DEBUG - Indicator: updateWeather: waiting for 'Cacher' thread to terminate
 [Fetcher] 2012-06-12 19:11:42,950 - DEBUG - Indicator: updateWeather: got condition 'None', icon 'None'
 [Fetcher] 2012-06-12 19:11:42,950 - DEBUG - Weather: day, show 'weather-clear' icon
 [Fetcher] 2012-06-12 19:11:42,958 - ERROR - 'NoneType' object has no attribute 'strftime'
 [Fetcher] 2012-06-12 19:11:42,963 - DEBUG - Traceback (most recent call last):
   File "/usr/bin/indicator-weather", line 1397, in get_new_weather_data
     log.debug("Indicator: fill in menu with params: city='%s', temp='%s', humid='%s', wind='%s', sunrise='%s', sunset='%s', puretemp=%s" % (self.places[self.placechosen][1], weather.get_temperature_label(), weather.get_humidity_label(), weather.get_wind_label(), weather.get_sunrise_label(), weather.get_sunset_label(), weather.get_temperature()))
   File "/usr/bin/indicator-weather", line 898, in get_sunrise_label
     return "%s: %s" % (_("Sunrise"), TimeFormatter.format_time(self.__sunrise_t))
   File "/usr/lib/python2.7/dist-packages/indicator_weather/helpers.py", line 248, in format_time
     return t.strftime(TimeFormatter.format)
 AttributeError: 'NoneType' object has no attribute 'strftime'

InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
NonfreeKernelModules: nvidia
Package: indicator-weather 11.11.28-0ubuntu1
PackageArchitecture: all
ProcEnviron:
 TERM=xterm
 PATH=(custom, user)
 LANG=ru_RU.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 3.2.0-24.39-generic 3.2.16
Settings:
 apps.indicators.weather condition-fields '["heat-index", "humidity", "wind", "sun"]'
 apps.indicators.weather filter-fields true
 apps.indicators.weather global-notifications false
 apps.indicators.weather indicator-display 1
 apps.indicators.weather locations "{'2112237': {'google id': ',,,56857500,60612500', 'noaa id': 'woot', 'longitude': '60.6125', 'yahoo id': u'RSXX1219', 'latitude': '56.8575', 'label': '\\xd0\\x95\\xd0\\xba\\xd0\\xb0\\xd1\\x82\\xd0\\xb5\\xd1\\x80\\xd0\\xb8\\xd0\\xbd\\xd0\\xb1\\xd1\\x83\\xd1\\x80\\xd0\\xb3', 'full name': '\\xd0\\x95\\xd0\\xba\\xd0\\xb0\\xd1\\x82\\xd0\\xb5\\xd1\\x80\\xd0\\xb8\\xd0\\xbd\\xd0\\xb1\\xd1\\x83\\xd1\\x80\\xd0\\xb3, \\xd0\\xa1\\xd0\\xb2\\xd0\\xb5\\xd1\\x80\\xd0\\xb4\\xd0\\xbb\\xd0\\xbe\\xd0\\xb2\\xd1\\x81\\xd0\\xba\\xd0\\xb0\\xd1\\x8f \\xd0\\xbe\\xd0\\xb1\\xd0\\xbb\\xd0\\xb0\\xd1\\x81\\xd1\\x82\\xd1\\x8c, \\xd0\\xa0\\xd0\\xbe\\xd1\\x81\\xd1\\x81\\xd0\\xb8\\xd1\\x8f'}}"
 apps.indicators.weather metric-system 'S'
 apps.indicators.weather notifications 'N'
 apps.indicators.weather placechosen 0
 apps.indicators.weather places "[['2112237', '\\xd0\\x95\\xd0\\xba\\xd0\\xb0\\xd1\\x82\\xd0\\xb5\\xd1\\x80\\xd0\\xb8\\xd0\\xbd\\xd0\\xb1\\xd1\\x83\\xd1\\x80\\xd0\\xb3']]"
 apps.indicators.weather refresh-rate 15
 apps.indicators.weather show-forecast true
 apps.indicators.weather show-locations false
 apps.indicators.weather weather '{}'
 apps.indicators.weather weather-source 'Y'
 apps.indicators.weather wind-unit 'mps'
SourcePackage: indicator-weather
Tags: precise
Uname: Linux 3.2.0-24-generic i686
UpgradeStatus: Upgraded to precise on 2012-05-24 (18 days ago)

Revision history for this message
Ilis (ilis) wrote :
Revision history for this message
Ilis (ilis) wrote :

Solved by restarting session.

Revision history for this message
Karol Gołąb (karol-golab) wrote :

No amount of restarts helps for me.

I guess the problem is in unreachable www.earthtools.org - or rather unexpected answer from there. I usually get very slow (10+ seconds) 404 from there.

Revision history for this message
MG (m12-griffin) wrote :
Download full text (3.7 KiB)

The problem is that it can't reach www.earthtools.org to get sunrise and sunset data. The web site gives a default hosting provider banner, so I assume that Earthtools is now defunct. Problems with this site could have been the cause of the recent regular crashes and stalls as well. The program seems to be faulting on the debug logging code, ironically, but even if that were fixed, it would simply fault at a later point. The assumption that sunrise and sunset times are available is built into the program quite extensively.

I patched my own copy of indicator-weather, and now it seems to be working fine. Yahoo has the sunrise and sunset times already in the weather response, so www.earthtools.org was really only needed if Google was being used as the weather forecast source. I changed my copy of /usr/bin/indicator-weather to the following:

    #Get sunrise/sunset times, calculate whether it is night already
    def get_sun_data(self):
        # Provide some valid default data.
        self.__night = False
        self.__sunrise_t = datetime.time(6, 00)
        self.__sunset_t = datetime.time(21, 00)

        if self.__weather_datasource == WeatherDataSource.YAHOO:
            try:
                sunrise = self.__report['astronomy']['sunrise']
                sunset = self.__report['astronomy']['sunset']
            except:
                log.error("Weather: error extracting sunrise or sunset")
                return

            try:
                self.__sunrise_t = datetime.datetime.strptime(sunrise, '%I:%M %p').time()
                self.__sunset_t = datetime.datetime.strptime(sunset, '%I:%M %p').time()
            except:
                log.error("Weather: error parsing sunrise '%s' or sunset '%s'" % (sunrise, sunset))
                return

        # Calculate, whether it is night or day
        localtime = datetime.datetime.now()
        if localtime.time()<self.__sunrise_t or localtime.time()>self.__sunset_t:
            self.__night = True
        else:
            self.__night = False
        log.debug("Weather: got localtime " +
            "%s, sunrise '%s', sunset '%s', night = %s" % (
            localtime, self.__sunrise_t, self.__sunset_t, self.__night))

I also set the weather source data (in preferences) to Yahoo. If you use Google, then the above code just uses some default values (6:00 am and 21:00) that happens to be (approximately) valid where I am now. If there is an error extracting the data from Yahoo, it uses the same "valid" defaults, so the whole thing won't stop working if Yahoo drops that data in the future.

This seems to be working fine so far (at least for the past 15 minutes or so). The user interface *assumes* that sunrise/sunset data is available, so there's no simple solution if you want to use Google. To keep Google as a data source will require UI changes to some of the display fields, as well as to the icon (sunny, cloudy, etc.) display. The quick and easy solution would be to do something like the above code and disable Google as a data source.

It appears that the indicator-weather developers are working on a major re-write, so perhaps what is really needed for now is a simple fix like the ab...

Read more...

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.