On 04/07/2010 04:36 PM, Luiz Capitulino wrote:


diff --git a/QMP/qmp.py b/QMP/qmp.py
index d9da603..f8581c4 100644
--- a/QMP/qmp.py
+++ b/QMP/qmp.py
@@ -8,7 +8,15 @@
  # This work is licensed under the terms of the GNU GPL, version 2.  See
  # the COPYING file in the top-level directory.

-import socket, json
+import socket
+
+from sys import version
+ver = version[:3]
+
+if ver == '2.6':
+    import json
+else:
+    import simplejson as json
  This won't do what we want for 2.7 and newer, so a better if would be:

if sys.version_info<  (2, 6):
     import simplejson as json
else:
     import json


try:
    import json
except:
    import simplejson as json

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.



Reply via email to