systematic use of context managers for dealing with files instead of open()/close...
[nepi.git] / src / nepi / resources / omf / application.py
index 8384024..8afb7c1 100644 (file)
@@ -286,13 +286,11 @@ class OMFApplication(OMFResource):
 
         if attr == TraceAttr.ALL:
             try:
-                f = open(trace_path ,'r')
+                with open(trace_path ,'r') as f:
+                    return f.read()
             except IOError:
                 print("File with traces has not been found")
                 return False
-            out = f.read()
-            f.close()
-        return out
 
 
     def do_start(self):