qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH 1/1] QMP test code - qmp.py


From: Avi Kivity
Subject: Re: [Qemu-devel] Re: [PATCH 1/1] QMP test code - qmp.py
Date: Wed, 07 Apr 2010 16:51:32 +0300
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4

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

[Prev in Thread] Current Thread [Next in Thread]