New submission from Chris Withers <ch...@simplistix.co.uk>: Hi All,
I'm splitting this out from [Issue1823] as it's a separate issue. Here's a minimal case to reproduce: >>> from email.MIMEMultipart import MIMEMultipart >>> from email.MIMEText import MIMEText >>> msg = MIMEMultipart() >>> msg.attach(MIMEText('foo','plain')) >>> msg.set_charset('utf-8') Traceback (most recent call last): File "<stdin>", line 1, in ? File "C:\python24\lib\email\Message.py", line 260, in set_charset self._payload = charset.body_encode(self._payload) File "C:\python24\lib\email\Charset.py", line 366, in body_encode return email.base64MIME.body_encode(s) File "C:\python24\lib\email\base64MIME.py", line 136, in encode enc = b2a_base64(s[i:i + max_unencoded]) TypeError: b2a_base64() argument 1 must be string or read-only buffer, not list NB: The exception raised can vary depending on the character set used: >>> msg.set_charset('iso-8859-15') Traceback (most recent call last): File "<stdin>", line 1, in ? File "C:\python24\lib\email\Message.py", line 260, in set_charset self._payload = charset.body_encode(self._payload) File "C:\python24\lib\email\Charset.py", line 368, in body_encode return email.quopriMIME.body_encode(s) File "C:\python24\lib\email\quopriMIME.py", line 180, in encode body = fix_eols(body) File "C:\python24\lib\email\Utils.py", line 62, in fix_eols s = re.sub(r'(?<!\r)\n', CRLF, s) File "C:\python24\lib\sre.py", line 142, in sub return _compile(pattern, 0).sub(repl, string, count) TypeError: expected string or buffer Chris ---------- messages: 83193 nosy: Sharebear, barry, christian.heimes, cjw296, loewis severity: normal status: open title: Exception raised when attempting to call set_charset on an email.mime.multipart once sub-parts have been attached _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5423> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com