Comment 24 for bug 533017

Revision history for this message
Ed S (edgar-b-dsouza) wrote : Re: Gwibber doesn't refresh streams

Using 2.30.0.1-0ubuntu1 on Lucid, with only a Twitter account, I get the same error as in #23 and #22 above:
line 136, in _get
    if data.has_key("error"):
AttributeError: 'list' object has no attribute 'has_key'

Looking at the source of the file, line 136 is the first line of an exception handler. It seems to expect that when an exception occurs, the content of the "data" variable is a dictionary with an "error" key. (This happens to be the case when authentication fails. When auth is successful, the timeline data is actually returned - I checked that with a temporary pprint.pprint(data) as the first line in the try block, then removed the line.)

The exception handler does not assign the exception to a variable, which would be useful for debugging (but, I think, not good for Python 3.x compatibility ... ?). For now, I modified the code like this:
    import pprint #at top of file
...
...
# in the _get function:
    # error is "Could not authenticate you" for failed auth
    try:
      if single: return [getattr(self, "_%s" % parse)(data)]
      if parse: return [getattr(self, "_%s" % parse)(m) for m in data]
      else: return []
    except Exception, e:
      print __file__, ": _get -- Exception: "
      pprint.pprint(e)
# if data.has_key("error"):
# if "authenticate" in data["error"]:
# raise exceptions.GwibberProtocolError("auth", self.account["protocol"], self.account["username"], data["error"])

After doing this, I ran gwibber-service in debug mode - with this output:

~$ gwibber-service -d -o
Updating...
Gwibber Dispatcher: DEBUG Setting up monitors
Gwibber Dispatcher: DEBUG Monitors are up
Gwibber Dispatcher: INFO Gwibber Service is reloading account credentials
Gwibber Dispatcher: DEBUG Refresh interval is set to 5
Gwibber Dispatcher: DEBUG ** Starting Refresh - Sun May 2 12:19:43 2010 **
Gwibber Dispatcher: DEBUG <twitter:responses> Performing operation
Gwibber Dispatcher: DEBUG <twitter:receive> Performing operation
/usr/lib/python2.6/dist-packages/gwibber/microblog/twitter.py : _get -- Exception:
Error('unsupported locale setting',)
Gwibber Dispatcher: DEBUG <twitter:responses> Finished operation
Gwibber Dispatcher: DEBUG <twitter:private> Performing operation
Gwibber Dispatcher: DEBUG <twitter:private> Finished operation
/usr/lib/python2.6/dist-packages/gwibber/microblog/twitter.py : _get -- Exception:
Error('unsupported locale setting',)
Gwibber Dispatcher: DEBUG <twitter:receive> Finished operation
Gwibber Dispatcher: INFO Loading complete: 1 - ['Success', 'Success', 'Success']

So it appears that it is a locale problem (?) that was not foreseen when writing the exception handler...

If someone could tell me how to check/change the locale on my system, I could change it and see if the problem is solved (for me). Other users posting on this bug could perhaps also check similarly to see if it is a locale setting that is causing the problem?

Is there any quick way to avoid this problem, other than waiting for translations for this particular locale to come out?

Thanks,
Ed.