eric6/eric6_post_install.py

changeset 7785
9978016560ec
parent 7781
607a6098cb44
child 7836
2f0d208b8137
--- a/eric6/eric6_post_install.py	Tue Oct 13 19:02:26 2020 +0200
+++ b/eric6/eric6_post_install.py	Wed Oct 14 17:50:39 2020 +0200
@@ -200,15 +200,13 @@
     @param dst destination file name (string)
     @param scriptsdir directory containing the scripts (string)
     """
-    f = open(src, "r", encoding="utf-8")
-    text = f.read()
-    f.close()
+    with open(src, "r", encoding="utf-8") as f:
+        text = f.read()
     
     text = text.replace("@BINDIR@", scriptsdir)
     
-    f = open(dst, "w", encoding="utf-8")
-    f.write(text)
-    f.close()
+    with open(dst, "w", encoding="utf-8") as f:
+        f.write(text)
     os.chmod(dst, 0o644)
 
 ######################################################################

eric ide

mercurial