按照上面的代碼執行之後,提示我
File "/usr/local b/python2.6/threading.py", line 525, in __bootstrap_inner
File "/home/houjw/monitor/DbMonitorThread.py", line 117, in run
File "/home/houjw/monitor/Alarm.py", line 15, in report
File "/home/houjw/monitor/myemail.py", line 23, in send_mail
File "/usr/local b/python2.6/email/mime/text.py", line 30, in __init__
File "/usr/local b/python2.6/email/message.py", line 224, in set_payload
File "/usr/local b/python2.6/email/message.py", line 264, in set_charset
File "/usr/local b/python2.6/email/encoders.py", line 73, in encode_7or8bit
LookupError: unknown encoding: ascii
sys.setdefaultencoding('utf8')
Module: email.mime.text
A subclass of MIMENonMultipart, the MIMEText class is used to create MIME objects of major type text. _text is the string for the payload. _subtype is the minor type and defaults to plain. _charset is the character set of the text and is passed as a parameter to the MIMENonMultipart constructor; it defaults to us-ascii. If _text is unicode, it is encoded using the output_charset of _charset, otherwise it is used as-is