hb_sz 发表于 2017-4-23 10:47:42

python发邮件问题

ImportError: No module named mime.text
2013年6月21日woyoo1,433 浏览数发表评论阅读评论 

生成环境的一个python脚本执行报错,老版本python中MIMEText 写法不对
 
 
 
 
 
Shell

 
1
2
3
4
5
6
7
8
9
10
11

[root@woyoo:~]# /usr/bin/python /data/logs/cut_nginx_log.py
Traceback(most recent call last):
  File"/data/logs/cut_nginx_log.py",line17,in?
    from email.mime.textimport MIMEText
ImportError:No module named mime.text
 
[root@woyoo:~]# python
Python2.4.3(#1, Jan  9 2013, 06:47:03)
[GCC4.1.220080704(Red Hat4.1.2-54)]on linux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>



修改为下面这样写法ok
 
 
 
 
 
Shell

 
1
2

from email.MIMETextimport MIMEText
from email.Headerimport Header



 
页: [1]
查看完整版本: python发邮件问题