Simplejson, python2.6 and windowsΒΆ

Tags: django

There was one additional problem I saw with yesterday’s windows installation: simplejson!

Totally unexpected. The good thing is that simplejson is shipped with python 2.6 and higher. The sane thing is that they named it “json” instead of “simplejson”.

The bad or at least unexpected thing: I cannot find a windows installer for simplejson for python 2.6! Which means my “import simplejson” won’t work anymore. And those have to be in as the software gets installed on python 2.5 sometimes.

For windows + python 2.6 compatibility I now have the following in at least 10 different files:

try:
    import json  # Python 2.6+
except ImportError:
    import simplejson as json  # Python 2.5-

And I’ve had to remove simplejson as a dependency. I don’t yet know a good solution for that. I don’t think you can have an optional dependency based on the python version with the current distribute/setuptools. Of course you could do some more if/else trickery in there as a setup.py` is just a python file after all.

Anyone got a good hint? Is there something I overlooked?

blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):