indicator-weather crashed with TypeError in ok(): 'NoneType' object has no attribute '__getitem__'

Bug #1191096 reported by Mattijs Riekerk
568
This bug affects 121 people
Affects Status Importance Assigned to Milestone
Weather Indicator
Fix Released
Medium
Unassigned

Bug Description

I went trough the set up and after filling everything I pressed OK and then it crashed.
The set up window just stayed there.

ProblemType: Crash
DistroRelease: Ubuntu 12.04
Package: indicator-weather 13.05.29+unstable+r336~precise1 [origin: LP-PPA-weather-indicator-team-unstable]
ProcVersionSignature: Ubuntu 3.2.0-45.70-generic-pae 3.2.44
Uname: Linux 3.2.0-45-generic-pae i686
NonfreeKernelModules: fglrx
ApportVersion: 2.0.1-0ubuntu17.3
Architecture: i386
CrashDB: indicator_weather
Date: Fri Jun 14 20:24:19 2013
ExecutablePath: /usr/bin/indicator-weather
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release i386 (20120423)
InterpreterPath: /usr/bin/python2.7
MarkForUpload: True
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/indicator-weather
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
PythonArgs: ['/usr/bin/indicator-weather']
SourcePackage: indicator-weather
ThirdParty: True
Title: indicator-weather crashed with TypeError in ok(): 'NoneType' object has no attribute '__getitem__'
Traceback:
 Traceback (most recent call last):
   File "/usr/bin/indicator-weather", line 2418, in ok
     if wi.places[i][0] == wi.place[0]:
 TypeError: 'NoneType' object has no attribute '__getitem__'
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo

Revision history for this message
Mattijs Riekerk (mattijs-riekerk) wrote :
Revision history for this message
Mattijs Riekerk (mattijs-riekerk) wrote :

It was a complete fresh install on my desktop.
Previous bugs where on my laptop, where I have the latest stable version running without any problems :)

Revision history for this message
Mattijs Riekerk (mattijs-riekerk) wrote :

Hmmmm....
After checking IndicatorLog.txt it seems my install was not fresh, so I ran the upgrade script.
And now it's running.

Changed in weather-indicator:
status: New → Fix Committed
Revision history for this message
Joshua Tasker (jtasker) wrote :

The error lies on line 2432 of /usr/bin/indicator-weather

To fix it, change the line from this:

                    if wi.places[i][0] == wi.place[0]:

to this:

                    if wi.places[i] is not None and wi.places[i][0] == wi.place[0]:

The fix will be included in the next unstable build.

Changed in weather-indicator:
importance: Undecided → Medium
milestone: none → 13.06.01
Revision history for this message
Joshua Tasker (jtasker) wrote :

Hmm, it may not be exactly that line number, so here is the corrected block of code:

        # If places have changed - update weather data
        if wi.places_changed:
            log.debug("Preferences: Places changed to '%s'" % wi.places)
            wi.settings.set_value("places", wi.places)
            wi.placechosen = 0
            if (type(wi.place) != None):
                for i in xrange(len(wi.places)):
                    if wi.places[i] is not None and wi.places[i][0] == wi.place[0]:
                        wi.placechosen = i
            wi.place = wi.places[0]
            log.debug("Preferences: Place Chosen changed to '%s'" % wi.placechosen)
            wi.settings.set_value("placechosen", wi.placechosen)
            wi.location_details = wi.settings.get_location_details(wi.place[0])
            need_to_update_weather = True
            wi.places_changed = False

Revision history for this message
Mathieu Marquer (slasher-fun) wrote :

Is there a way to reset the cities list? There is no more crash when adding a city after manually applying the patch, but no city appear when clicking on the icon, even when there are multiple cities selected in the settings.

Revision history for this message
Mathieu Marquer (slasher-fun) wrote :

OK, I did a gsettings reset-recursively apps.indicators.weather in order to reset the settings, but the behavior is still weird:
* After opening the app, no city is shown (normal)
* I add a city in the list --> the city appears in the list in the settings
* I click on "OK" in the settings (many times) --> nothing happens
* I click on "Cancel" --> the settings window is closed
* I shut down the app, then reopen it --> the city i previously selected appears. Still no city shown when left clicking on the icon, even if adding multiple cities.

Revision history for this message
Joshua Tasker (jtasker) wrote :

Can you attach your ~/.cache/indicator-weather.log file?

Revision history for this message
maoriveros (maoriveros) wrote : Re: [Bug 1191096] Re: indicator-weather crashed with TypeError in ok(): 'NoneType' object has no attribute '__getitem__'

Sure - there it is...

El 07/08/13 19:31, Joshua Tasker escribió:
> Can you attach your ~/.cache/indicator-weather.log file?
>

Joshua Tasker (jtasker)
Changed in weather-indicator:
status: Fix Committed → Fix Released
Revision history for this message
Greg Gilfillan (greggilfillan) wrote :

Crash occurred after pressing OK on initial setup of fresh install. I closed and re-ran the program and it appears to be working fine now, except there is no ICON for "Isolated Thunderstorms" in the Forecast. But I suppose that's probably unrelated.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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