python: Fix print function compatibility.
[cascardo/ovs.git] / tests / test-jsonrpc.py
index 9a24933..18634e6 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, 2011 Nicira Networks
+# Copyright (c) 2009, 2010, 2011 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import print_function
+
 import argparse
 import errno
 import os
@@ -86,7 +88,7 @@ def do_listen(name):
             if error:
                 rpc.close()
                 dead_rpcs.append(rpc)
-        rpcs = [rpc for rpc in rpcs if not rpc in dead_rpcs]
+        rpcs = [rpc for rpc in rpcs if rpc not in dead_rpcs]
 
         if done and not rpcs:
             break
@@ -127,7 +129,7 @@ def do_request(name, method, params_string):
         sys.stderr.write("error waiting for reply: %s\n" % os.strerror(error))
         sys.exit(1)
 
-    print ovs.json.to_string(msg.to_json())
+    print(ovs.json.to_string(msg.to_json()))
 
     rpc.close()
 
@@ -187,7 +189,7 @@ notify REMOTE METHOD PARAMS  send notification and exit
 
     command_name = args.command[0]
     args = args.command_args
-    if not command_name in commands:
+    if command_name not in commands:
         sys.stderr.write("%s: unknown command \"%s\" "
                          "(use --help for help)\n" % (argv[0], command_name))
         sys.exit(1)