[email/quoprimime.py] AttributeError: 'tuple' object has no attribute 'lstrip'
tjreedy at udel.edu
Mon Jan 5 23:54:19 CET 2009
Gilles Ganault wrote:
> I successfully use the email package to send e-mail from Python
> scripts, but this script fails when I fetch addresses from an SQLite
> database where data is Unicode-encoded:
> from email.MIMEText import MIMEText
> import smtplib,sys
> import apsw
> subject = "My subject"
> f = open("message.txt", "r")
> message = f.read()
> msg = MIMEText(message)
> msg['Subject'] = subject
>>From = "me at acme.com"
> msg['From'] = From
> server = smtplib.SMTP("smtp.acme.com")
> sql="SELECT email FROM people WHERE email IS NOT NULL"
> for email in rows:
> To = email
Why is 'email' renamed 'To'?
> msg['To'] = email
> #print To
> #(u'dummy at acme.com',)
Why are these line comments?
Why is the string enclosed in a tuple?
> #AttributeError: 'tuple' object has no attribute 'lstrip'
True. Only strings have lstrip method.
Ditto. This looks looks a line from a doc.
If you want help interpreting an error message,
copy and paste the *entire traceback* without editing.
> Does someone know what is wrong with the above?
Why do you think anything is wrong? Post the actual error message
separate from the code that generates the error message.
> Does email choke on Unicode?
More information about the Python-list