weather applet crashes when you add a locality

Bug #1090890 reported by Riccardo Padovani on 2012-12-16
306
This bug affects 70 people
Affects Status Importance Assigned to Milestone
Weather Indicator
Undecided
r

Bug Description

I try to add a new locality and nothing append. After few minutes, apport say that something went wrong!

ProblemType: Crash
DistroRelease: Ubuntu 12.04
Package: indicator-weather 12.07.30~precise1 [origin: LP-PPA-weather-indicator-team]
ProcVersionSignature: Ubuntu 3.2.0-34.53-generic 3.2.33
Uname: Linux 3.2.0-34-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.0.1-0ubuntu17
Architecture: amd64
CrashDB: indicator_weather
Date: Sun Dec 16 13:16:04 2012
ExecutablePath: /usr/bin/indicator-weather
InstallationMedia: Ubuntu 12.04.1 LTS "Precise Pangolin" - Release amd64 (20120823.1)
InterpreterPath: /usr/bin/python2.7
MarkForUpload: True
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/indicator-weather
ProcEnviron:
 PATH=(custom, no user)
 LANG=it_IT.UTF-8
 SHELL=/bin/bash
PythonArgs: ['/usr/bin/indicator-weather']
SourcePackage: indicator-weather
ThirdParty: True
Title: indicator-weather crashed with AttributeError in export_location_details(): Location instance has no attribute 'location_code'
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo

Riccardo Padovani (rpadovani) wrote :
information type: Private → Public
Sabin Iacob (iacobs) wrote :

Happens here as well:

Traceback (most recent call last):
  File "/usr/bin/indicator-weather", line 1893, in on_apply
    (location_code, location_details) = self.location.export_location_details()
  File "/usr/bin/indicator-weather", line 406, in export_location_details
    return (self.location_code, self.location_details)
AttributeError: Location instance has no attribute 'location_code'

Turns out it's a problem at line 362, where it checks for errors from Yahoo:

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

is always true because yahoo_woeid_result['ResultSet']['Error'] is a string; I fixed it by comparing with a string as well:

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

so it's an easy fix

However, I take a _big_ issue with this:

            yahoo_woeid_result = eval(s)

where s is a JSON string; you're kidding, right?

Croz (croz) wrote :

Sabin's fix worked for me.

Thanks!

Edward (ecadman) wrote :

Can someone post a sed command that will fix this? Despite my attempts, I can't seem to put together a sed statement that fixes it.

Conrad (conrad-couture) wrote :

I tried to fix, as well with no success.

Martin B. (bachwerm) wrote :

Hey, that worked for me (had it 5 lines below though). Also now that I can add locations, I can also save the other settings (the OK button was greyed out before). Cheers!

davide (linuxdavide) wrote :

Hi Martin B., can you help me please? :-)
I installed this morning that applet but it doesn't add my city! I click on "Apply" without success!

1) From shell I started indicator-weather:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
davide@Thunder:~$ indicator-weather
/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
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

2) After, from GUI, I tried to add my city:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/bin/indicator-weather", line 1883, 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'
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I use Ubuntu 12.04 LTS with Gnome (No effects)

Thanks!

sabin's fix worked for me either ! (if I use yahoo only : doesn't work for google)
[ I use 12.04 32bits]
but if I launch indicator-weather from terminal, I have the same bug that david (g_type_from_name)

looks like a bug from another library (gobject or included by gobject)

thanks sabin xxx

marc

Sylvain LALOZE (sylspy20) wrote :

Thank's to Sabin

That's work fine.
Indicateur météo 12.07.30 'Cloudy 10'

In the file /usr/bin/indicator-weather at line 367
I modify 0 in '0' like this, to compare with a string
if (yahoo_woeid_result['ResultSet']['Error'] != '0') and (yahoo_woeid_result['ResultSet']['Results'] != None):

gea (frost-52) on 2013-01-08
Changed in weather-indicator:
assignee: nobody → gea (frost-52)
status: New → Fix Released
alin ciolompea (alinciolompea) wrote :

Thanks, Sabin!

Cosmic Dragon (yerbamater) wrote :

SABIN
"Turns out it's a problem at line 362, where it checks for errors from Yahoo:

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

is always true because yahoo_woeid_result['ResultSet']['Error'] is a string; I fixed it by comparing with a string as well:

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

so it's an easy fix"

Thanks! :)

WhatTheTech (info-s) wrote :

Ran #sudo gedit /usr/bin/indicator-weather
Went to the issue.
Added the ' ' around the 0.
Saved.
No change!

Any other ideas? I would really like to get this working!
Thanks in advance!

WhatTheTech (info-s) wrote :

Never mind, I had only logged in and out, but a full restart and it was fixed. Thank you Sabin!

r (rallen-34) on 2013-07-15
Changed in weather-indicator:
assignee: gea (frost-52) → r (rallen-34)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions