Getting crazy with gwibber, part 1, or python-simplejson and the evil file

I met Gwibber about 5 months ago, and was a happy user. For those who don’t know Gwibber, it’s a identi.ca/twitter/many more client for Gnome.

Well, the one feature I was missing on it was a tab only for replies, as TwitterFox does, and one day @jorge announced (and other people excited about it commented) on identi.ca that the newest version just released that time got that tab. So, I ran to find a console window, and then, after the update, thought: “Cool! Let’s check out the new feature!”. Closed gwibber, reopened and.. sigh. It suddenly stopped working.

I thought myself “WTH”, and kept trying to open it, without success. It was freezing, after a few seconds open.

Finding that thing weird, I started doing the good’ol debugging thing, and found out that the problem was when retrieving messages. With the possible bug in hands, went to my beloved Launchpad to see if there were any open bugs reporting the problem, and if not, open a new one providing all the info I’d gathered in all that debugging. For my luck (or not :)) I’ve found one possible bug, and then commented on it, giving the problem I was having:

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.5/threading.py", line 486, in __bootstrap_inner
self.run()
File "/usr/lib/python2.5/threading.py", line 446, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.5/site-packages/gwibber/client.py", line 685, in process
view.load_messages()
File "/usr/lib/python2.5/site-packages/gwibber/gwui.py", line 52, in load_messages
indent=4, default=str)
File "build/bdist.linux-i686/egg/simplejson/__init__.py", line 216, in dumps
TypeError: __init__() got an unexpected keyword argument 'default'

At that point I already had tried everything: reinstalling python-simplejson, gwibber and python-webkitgtk, also using –purge, and nothing.
One suggested that it could be my version of python-simplejson, considering that this error wasn’t supposed to happen with python-simplejson version 1.9.1. Unfortunately, that was exactly my version according to dpkg, and I got desolated. What would I do?

So I downloaded gwibber code and started messing to see how stuff works, and then realized that doing a import simplejson and calling the dumps function would give me the same error, so the problem wasn’t on gwibber or the way it could be calling the module. Given that, intrigued, opened ipython, did again the same import simplejson, simplejson.dumps(default=”bla”, {}) thing and noticed this time:

/usr/lib/python2.5/site-packages/simplejson-1.7.3-py2.5-linux-i686.egg/simplejson/__init__.pyc in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, encoding, **kw)
TypeError: __init__() got an unexpected keyword argument 'default'

Yes, a simplejson.__version__ confirmed the crack: 1.7.3. But why oh why that thing was there if I uninstalled and installed it exaustively, and then checked and rechecked the package version with dpkg -L python-simplejson?

After a minute of frustration, I realized the python-simplejson package wasn’t placing any files on that folder. Maybe because of a packaging problem, removing python-simplejson package didn’t erased the file on site-packages. A rm -rf simplejson-1.7.3-py2.5-linux-i686.egg was enough to solve the problem. After that, just out of curiosity, I did the import simplejson and voila, version 1.9.1.

It stopped freezing, but the window it open was blank. So what now? More in the next post..

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>