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)
注意无法导入,但我的脚本运行正常。这是有问题的代码:
#!/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():
当我运行程序时效果很好,但为什么pylint会抱怨?
我只是通过
来运行pylintpylint sendmail.py
安装了pylint和logilab库
使用python 2.6.6,python 64和32位都以同样的方式抱怨。
答案 0 :(得分:5)
在Python 2.5中重命名了各种大写名称。有关详细信息,请参阅http://docs.python.org/release/2.7/library/email.html#package-history。基础email
包的__init__.py
做了一些技巧来使旧名称在python中工作,但是因为pylint有自己独立的导入方法,所以这些技巧在pylint中不起作用。
切换到新名称,你应该没问题:
from email.mime import multipart as MIMEMultipart
from email.mime import base as MIMEBase
from email import encoders as Encoders
例如。