eric6/UI/EmailDialog.py

changeset 7785
9978016560ec
parent 7771
787a6b3f8c9f
child 7836
2f0d208b8137
equal deleted inserted replaced
7784:3257703e10c5 7785:9978016560ec
274 maintype, subtype = itm.text(1).split('/', 1) 274 maintype, subtype = itm.text(1).split('/', 1)
275 fname = itm.text(0) 275 fname = itm.text(0)
276 name = os.path.basename(fname) 276 name = os.path.basename(fname)
277 277
278 if maintype == 'text': 278 if maintype == 'text':
279 txt = open(fname, 'r', encoding="utf-8").read() 279 with open(fname, 'r', encoding="utf-8") as f:
280 txt = f.read()
280 try: 281 try:
281 txt.encode("us-ascii") 282 txt.encode("us-ascii")
282 att = MIMEText(txt, _subtype=subtype) 283 att = MIMEText(txt, _subtype=subtype)
283 except UnicodeEncodeError: 284 except UnicodeEncodeError:
284 att = MIMEText( 285 att = MIMEText(

eric ide

mercurial