Startup problems - wifi connections

Bug #606729 reported by joshuaruehlig
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Weather Indicator
Fix Released
High
Vadim Rutkovsky

Bug Description

The indicator-weather now starts on startup (only when you have an internet connection as the applet loads). This means if you are on a mobile device that takes 30seconds to connect to wifi the indicator-weather chooses not to show up and is killed. (It doesn't show up in system monitor). Running another instance with a connection fixes the problem but requires work from the user.

One way to fix this would be to have a delay on the startup of indicator weather, this is not ideal as some users wont have a connection or even longer periods of time.

A better solution would be instead of killing the applet having it check if there is an active internet connection, if not set a timer for ~5mins and trying again. This is also not ideal as you are wasting a few cpu cycles if you don't plan on having an internet connection for a computing session, but this is not much of an impact.

Revision history for this message
joshuaruehlig (joshruehlig) wrote :

One way I have been fixing this is running a startup script
sleep 25
indicator-weather

this usually works, but sometimes I am not already connected to the internet (I could make the timeout longer) and other times when on a ethernet connection I get two weather icons. Not too great of a fix

Changed in weather-indicator:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
joshuaruehlig (joshruehlig) wrote :

this may be a duplicate of bug #596528.
If you experienced that bug please test by starting up computer with an Ethernet cable already ready to supply internet upon startup of gnome-panel.

Revision history for this message
Jacopo Moronato (jmoronat) wrote :

I don't think it's dupe of bug #596528.
As for description, it seems to deal with no automatic start on wifi-equiped machines.
Perhaps title could be changed to "startup problems with wifi connections".

summary: - Startup Problems
+ Startup problems - wifi connections
Revision history for this message
joshuaruehlig (joshruehlig) wrote :

if my writeup is too long please edit it to keep it concise, thanks

Revision history for this message
Cullen Maglothin (cullendm) wrote :

Oddly if one is using indicator-network it connects fine. I think that is because indicator-network connects before startup if you have already selected one of the available connections before.

Revision history for this message
joshuaruehlig (joshruehlig) wrote :

Maybe indicator-network starts up faster and is connected by the time indicator-weather starts. I will test this later this week (when I have an accessible wifi connection).

Revision history for this message
Mark Baas (mark-baas123) wrote :

Also the current bzr of today crashes when no connection:
Traceback (most recent call last):
  File "/usr/bin/indicator-weather", line 923, in <module>
    wi = indicator_weather()
  File "/usr/bin/indicator-weather", line 97, in __init__
    self.update_weather()
  File "/usr/bin/indicator-weather", line 254, in update_weather
    sunrise,sunset,timezone = self.get_sun(self.places[self.placechosen])
  File "/usr/bin/indicator-weather", line 371, in get_sun
    return error,error
NameError: global name 'error' is not defined
I would suggest return None on error and correctly capture the error. Then an if statement in the update_weather after obtaining the results checking whether. IF none then return, else continue. I made a small patch:

=== modified file 'bin/indicator-weather'
--- bin/indicator-weather 2010-07-10 23:10:38 +0000
+++ bin/indicator-weather 2010-07-23 17:39:13 +0000
@@ -251,7 +251,11 @@

     def update_weather(self, notif=True,widget=None):
         current = self.get_weather(self.places[self.placechosen])
- sunrise,sunset,timezone = self.get_sun(self.places[self.placechosen])
+ result = self.get_sun(self.places[self.placechosen])
+ if result == None:
+ return
+ else:
+ sunrise,sunset,timezone = result
         now = datetime.datetime.now().time()
         sunrise_t = datetime.time(int(sunrise.split(':')[0]), int(sunrise.split(':')[1]), int(sunrise.split(':')[2]))
         sunset_t = datetime.time(int(sunset.split(':')[0]), int(sunset.split(':')[1]), int(sunset.split(':')[2]))
@@ -367,15 +371,15 @@
         url = 'http://maps.google.com/maps/api/geocode/json?address='+urllib2.quote(city)+'&sensor=false'
         try:
             result = simplejson.load(urllib2.urlopen(url))
- except:
- return error,error
+ except urllib2.URLError, error:
+ return None
         lat,lon = result['results'][0]['geometry']['location']['lat'],result['results'][0]['geometry']['location']['lng']
         now = datetime.datetime.now()
         url = 'http://www.earthtools.org/sun/%s/%s/%s/%s/99/1' % (lat,lon,now.day,now.month)
         try:
             f = urllib2.urlopen(url)
- except:
- return error,error
+ except urllib2.URLError, error:
+ return None
         s=f.read()
         parsed = parseString(s)
         sunrise = parsed.getElementsByTagName("sunrise")[0].firstChild.nodeValue

Revision history for this message
Vadim Rutkovsky (roignac) wrote :

Thanks, Mark, a great job!
I've applied the patch and modified it a bit more. Now the indicator should correctly handle connection status

Changed in weather-indicator:
assignee: nobody → Vadim Rutkovsky (roignac)
status: Confirmed → Fix Committed
Changed in weather-indicator:
status: Fix Committed → Fix Released
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.