eric6/Cooperation/ChatWidget.py

changeset 7785
9978016560ec
parent 7780
41420f82c0ac
child 7836
2f0d208b8137
--- a/eric6/Cooperation/ChatWidget.py	Tue Oct 13 19:02:26 2020 +0200
+++ b/eric6/Cooperation/ChatWidget.py	Wed Oct 14 17:50:39 2020 +0200
@@ -573,9 +573,8 @@
                     fname = Utilities.toNativeSeparators(fname)
                 
                 try:
-                    f = open(fname, "w", encoding="utf-8")
-                    f.write(txt)
-                    f.close()
+                    with open(fname, "w", encoding="utf-8") as f:
+                        f.write(txt)
                 except IOError as err:
                     E5MessageBox.critical(
                         self,

eric ide

mercurial