errors while trying to send email

Ronald Kijewski ronald.kijewski at swri.org
Wed Sep 28 16:00:06 CEST 2005


I've seen another bug submission similar to this.  I am using 2.3.4 and I get almost the exact same error.  I'm on a linux box (2.6.9-5.ELsmp) and the same code runs fine on other machines and previous versions of python - here's the code snippet:

msg = MIMEMultipart()
COMMASPACE = ', '
msg['Subject'] = 'NO Build (' + tstr + ')'
msg['From'] = 'rkijewski at swri.org'
msg['To'] = COMMASPACE.join(buildmgrs)
msg['To'] = buildlead
msg.preamble = 'Build Results'
msg.epilogue = ''

mailsrv = smtplib.SMTP('server')
mailsrv.sendmail(buildlead, buildlead, msg.as_string())
time.sleep(5)
mailsrv.close()
################################################

Here's the error:

Traceback (most recent call last):
  File "./testMail.py", line 60, in ?
    mailsrv.sendmail(buildlead, buildlead, msg.as_string(unixfrom=True))
  File "/usr/lib64/python2.3/email/Message.py", line 130, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/usr/lib64/python2.3/email/Generator.py", line 102, in flatten
    self._write(msg)
  File "/usr/lib64/python2.3/email/Generator.py", line 137, in _write
    self._write_headers(msg)
  File "/usr/lib64/python2.3/email/Generator.py", line 183, in _write_headers
    header_name=h, continuation_ws='\t').encode()
  File "/usr/lib64/python2.3/email/Header.py", line 415, in encode
    return self._encode_chunks(newchunks, maxlinelen)
  File "/usr/lib64/python2.3/email/Header.py", line 375, in _encode_chunks
    _max_append(chunks, s, maxlinelen, extra)
  File "/usr/lib64/python2.3/email/quopriMIME.py", line 84, in _max_append
    L.append(s.lstrip())
AttributeError: 'list' object has no attribute 'lstrip'


Thanks




More information about the Python-bugs-list mailing list