"Example for PyLint problem"
def sendMail(pSmtpServer, pTo, pFrom, pSubject, pBody=''):
"""
Send an email and return True if successful.
"""
from smtplib import SMTP
from email.MIMEText import MIMEText
from email.Header import Header
try:
# Create the message ('plain' stands for Content-Type: text/plain)
msg = MIMEText(pBody, 'plain')
msg['From'] = pFrom
msg['To'] = pTo
msg['Subject'] = Header(pSubject)
# Send the message via SMTP server
server = SMTP(pSmtpServer)
server.sendmail(pFrom, pTo, msg.as_string())
server.quit()
return True
except:
return False
When I pyLint the following code above I receive the following messages:
E: 8:sendMail: No name 'MIMEText' in module 'email'
F: 8:sendMail: Unable to import 'email.MIMEText'
E: 9:sendMail: No name 'Header' in module 'email'
F: 9:sendMail: Unable to import 'email.Header'
But the program is running withount any problems. I guess there is a bug in
pyLint.
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects