On Wed, Apr 7, 2010 at 16:51, Avi Kivity <a...@redhat.com> wrote: >> This won't do what we want for 2.7 and newer, so a better if would be:
Thats why i said it is just an ugly hack :) Anyway, I've just cloned the qmp-unstable tree to run some tests and report back >> if sys.version_info< (2, 6): >> import simplejson as json >> else: >> import json >> >> > > try: > import json > except: > import simplejson as json I thought of that, but the thing is that, in Debian at least, there is python-json for python 2.5 which does not work, but can be imported, and also python-simplejson. On python2.6 json module is included and there is a package python2.6-simplejson also. Anyway, we can't check what every distribution does with modules, so I think Avi's solution works most of the times. In the end it is just a test script :) Thanks for the comments :) -- Costas Drogos