eric6/QScintilla/Exporters/ExporterHTML.py

changeset 7785
9978016560ec
parent 7781
607a6098cb44
child 7836
2f0d208b8137
diff -r 3257703e10c5 -r 9978016560ec eric6/QScintilla/Exporters/ExporterHTML.py
--- a/eric6/QScintilla/Exporters/ExporterHTML.py	Tue Oct 13 19:02:26 2020 +0200
+++ b/eric6/QScintilla/Exporters/ExporterHTML.py	Wed Oct 14 17:50:39 2020 +0200
@@ -454,9 +454,8 @@
         if html:
             try:
                 with E5OverrideCursor():
-                    f = open(filename, "w", encoding="utf-8")
-                    f.write(html)
-                    f.close()
+                    with open(filename, "w", encoding="utf-8") as f:
+                        f.write(html)
             except IOError as err:
                 E5MessageBox.critical(
                     self.editor,

eric ide

mercurial