hopefully fewer leaks in files : always use a context manager to open files
[nodemanager.git] / conf_files.py
index c16639f..fcc3b7d 100644 (file)
@@ -1,6 +1,3 @@
-# $Id$
-# $URL$
-
 """configuration files"""
 
 import grp
@@ -110,7 +107,8 @@ if __name__ == '__main__':
 
     # Load /etc/planetlab/session
     if os.path.exists(options.session):
-        session = file(options.session).read().strip()
+        with open(options.session) as f:
+            session = f.read().strip()
     else:
         session = options.session