On 10/23/2009 10:13 AM, Helmut Namyslo wrote:
...
from smtplib import SMTP
from email.MIMEText import MIMEText
from email.Header import Header
...
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.

Wrong guess. The email module just uses dirty tricks which pylint doesn't know about.

The example uses old names which are more or less deprecated. The old names and the hacks used to make them work causes all kinds of trouple - see for example http://bugs.python.org/issue2622.

Pylint doesn't complain if you use
    from email.mime.text import MIMEText
    from email.header import Header

Pylint could perhaps be taught to give other/better warnings in this case. But unless it can be taught to handle that kind of hacks in general then I don't think it is worth fixing.

/Mads
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to