eric6/Plugins/VcsPlugins/vcsGit/ConfigurationPage/GitPage.py

changeset 7785
9978016560ec
parent 7780
41420f82c0ac
child 7836
2f0d208b8137
--- a/eric6/Plugins/VcsPlugins/vcsGit/ConfigurationPage/GitPage.py	Tue Oct 13 19:02:26 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/ConfigurationPage/GitPage.py	Wed Oct 14 17:50:39 2020 +0200
@@ -94,11 +94,10 @@
                 firstName, lastName, email = (
                     "Firstname", "Lastname", "email_address")
             try:
-                f = open(cfgFile, "w")
-                f.write("[user]\n")
-                f.write("    name = {0} {1}\n".format(firstName, lastName))
-                f.write("    email = {0}\n".format(email))
-                f.close()
+                with open(cfgFile, "w") as f:
+                    f.write("[user]\n")
+                    f.write("    name = {0} {1}\n".format(firstName, lastName))
+                    f.write("    email = {0}\n".format(email))
             except (IOError, OSError):
                 # ignore these
                 pass

eric ide

mercurial