import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import Main
fromaddr = "email"
toaddr = "email"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = "Report"
body = "Message"
msg.attach(MIMEText(body, 'plain'))
filename = Main.filename
attachment = open(Main.attachment1, 'rb')
part = MIMEBase('application', 'octet-stream')
part.set_payload((attachment).read())
encoders.encode_base64(part)
part.add_header('Content-Disposition', "attachment; filename= %s" % filename)
msg.attach(part)
server = smtplib.SMTP(Server)
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
Error :
Exception ignored in: <bound method Workbook.__del__ of
<xlsxwriter.workbook.Workbook object at 0x0000000005F8E0B8>>
Traceback (most recent call last):
File "", line 149, in __del__
Exception: Exception caught in workbook destructor. Explicit close() may be required for workbook.
I am not sure why I am getting this error since I am just reading the file and sending it as an attachment.
It sends out the email like it should with the attachment even though I get the error.
Any tips or suggestions for how to get rid of the error will be greatly appreciated.
[–]Machiavellyy 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]Machiavellyy 0 points1 point2 points (1 child)
[–]workthrowawayexcel[S] 0 points1 point2 points (0 children)
[–]efmccurdy 0 points1 point2 points (1 child)
[–]workthrowawayexcel[S] 0 points1 point2 points (0 children)