still making both branches closer
[nepi.git] / examples / linux / ccn_transfer_using_linuxapp.py
index fb4f74d..8bf7cfc 100644 (file)
@@ -40,6 +40,8 @@
 # $ cd <path-to-nepi>
 # python examples/linux/ccn_advanced_transfer.py -a <hostname1> -b <hostname2> -u <username> -i <ssh-key>
 
+from __future__ import print_function
+
 from nepi.execution.ec import ExperimentController
 from nepi.execution.resource import ResourceAction, ResourceState
 
@@ -116,7 +118,7 @@ def add_ccnd(ec, peers):
 
     # BASH command -> ' ccndstart ; ccndc add ccnx:/ udp  host ;  ccnr '
     command = "ccndstart && "
-    peers = map(lambda peer: "ccndc add ccnx:/ udp  %s" % peer, peers)
+    peers = ["ccndc add ccnx:/ udp  %s" % peer for peer in peers]
     command += " ; ".join(peers) + " && "
     command += " ccnr & "
 
@@ -205,12 +207,11 @@ apps = [ccncat]
 ec.wait_finished(apps)
 
 stdout = ec.trace(ccncat, "stdout")
-f = open("video.ts", "w")
-f.write(stdout)
-f.close()
+with open("video.ts", "w") as f:
+    f.write(stdout)
 
 # Shutdown the experiment controller
 ec.shutdown()
 
-print "Transfered FILE stored localy at video.ts"
+print("Transfered FILE stored localy at video.ts")