No config file found, using default configuration
************* Module sendmail
C:153,0: Line too long (146/80)
C:156,0: Line too long (105/80)
C:190,0: Line too long (88/80)
F: 8,0: Unable to import 'email.MIMEMultipart'
E: 8,0: No name 'MIMEMultipart' in module 'email'
F: 9,0: Unable to import 'email.MIMEBase'
E: 9,0: No name 'MIMEBase' in module 'email'
E: 10,0: No name 'Encoders' in module 'email'
R: 47,0:sendmail: Too many arguments (7/5)
R: 47,0:sendmail: Too many local variables (17/15)
W: 74,4:sendmail: No exception type(s) specified
W: 95,12:sendmail: No exception type(s) specified
R:142,0:commandline_handler: Too many branches (15/12)
Notice the inability to import, but my script works fine. Here's the code in question:
#!/usr/local/bin/python
''' sendmail module.
Can be used to send mail, attachments, or otherwise.
'''
from email.mime.text import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email import Encoders
import getopt
import os
import smtplib
import sys
def main():
When I run the program it works great, but why does pylint complain?
I ran pylint by simply doing
pylint sendmail.py
I installed pylint and the logilab libraries from http://www.logilab.org/
Both python 64 and 32 bit complain the same way, using python 2.6.6.
The various uppercase names were renamed in Python 2.5. See http://docs.python.org/release/2.7/library/email.html#package-history for details. The base email
package's __init__.py
does some tricks to make the old names work in python, but because pylint has its own separate method of doing imports, those tricks don't work in pylint.
Switch over to the new names and you should be fine:
from email.mime import multipart as MIMEMultipart
from email.mime import base as MIMEBase
from email import encoders as Encoders
for example.