eric6/UI/EmailDialog.py

changeset 7785
9978016560ec
parent 7771
787a6b3f8c9f
child 7836
2f0d208b8137
--- a/eric6/UI/EmailDialog.py	Tue Oct 13 19:02:26 2020 +0200
+++ b/eric6/UI/EmailDialog.py	Wed Oct 14 17:50:39 2020 +0200
@@ -276,7 +276,8 @@
             name = os.path.basename(fname)
             
             if maintype == 'text':
-                txt = open(fname, 'r', encoding="utf-8").read()
+                with open(fname, 'r', encoding="utf-8") as f:
+                    txt = f.read()
                 try:
                     txt.encode("us-ascii")
                     att = MIMEText(txt, _subtype=subtype)

eric ide

mercurial