Decode II (more complex)

Thomas Lehmann t.lehmann at rtsgroup.net
Mon Jun 21 12:03:18 EDT 2010


> Your email(s) get send as 7 bit (ASCII). Email them as utf-8 and I guess
> your problem is solved.
>
> How do you email the notifications?
>

 I was copying partly the logic from http://code.activestate.com/recipes/473810
 Changing to buffer.decode("utf-8", 'replace') where I'm reading the
file and
 changing the html template at top to utf-8 leads to following output:

 File "/srv/buildManager/BuildManagerMail.py", line 27, in sendMail
    msgText = MIMEText(htmlMessage, 'html')
  File "/usr/lib64/python2.6/email/mime/text.py", line 30, in __init__
    self.set_payload(_text, _charset)
  File "/usr/lib64/python2.6/email/message.py", line 224, in
set_payload
    self.set_charset(charset)
  File "/usr/lib64/python2.6/email/message.py", line 264, in
set_charset
    cte(self)
  File "/usr/lib64/python2.6/email/encoders.py", line 73, in
encode_7or8bit
    orig.encode('ascii')
AttributeError: 'DynamicallyCompiledCheetahTemplate' object has no
attribute 'encode'



More information about the Python-list mailing list