Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pylint not recognizing some of the standard library

I'm using pylint + pydev, with python 2.6. I have a module with just this line of code

from email import Message

Now when I try to run this module it runs fine. But pylint reports an error:

ID: E0611 No name 'Message' in module 'email'

Although it exists... Any idea why?

like image 230
olamundo Avatar asked Aug 22 '09 16:08

olamundo


1 Answers

realise this is an old question, but the correct answer is that the older ways of invoking what you need, which use the "import hackery" that Richie describes, have long been deprecated (despite still appearing in many tutorials). If you use the new ways, you'll be writing better code and pylint won't complain.

e.g.

from email import Message
from email import Header
from email.MIMEText import MIMEText

should be

from email.message import Message
from email.header import Header
from email.mime.text import MIMEText

etc.

like image 55
simon Avatar answered Oct 06 '22 00:10

simon