systematic use of context managers for dealing with files instead of open()/close...
[nepi.git] / examples / linux / ccn_transfer_using_linuxapp.py
index 0395a40..1db375d 100644 (file)
@@ -207,9 +207,8 @@ 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()