systematic use of context managers for dealing with files instead of open()/close...
[nepi.git] / src / nepi / resources / linux / node.py
index 16b9b00..df3030b 100644 (file)
@@ -477,7 +477,8 @@ class LinuxNode(ResourceManager):
                 ########################
 
                 import pickle
-                pids = pickle.load(open("/tmp/save.proc", "rb"))
+                with open("/tmp/save.proc", "rb") as pickle_file:
+                    pids = pickle.load(pickle_file)
                 pids_temp = dict()
                 ps_aux = "ps aux | awk '{print $2,$11}'"
                 (out, err), proc = self.execute(ps_aux)