classification
Title: cannot create multipart alternative message with us-ascii charset
Type: behavior Stage:
Components: email Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Viktor.Szépe, barry, r.david.murray
Priority: normal Keywords:

Created on 2014-05-23 22:59 by Viktor.Szépe, last changed 2018-07-11 07:35 by serhiy.storchaka.

Messages (3)
msg219009 - (view) Author: Viktor Szépe (Viktor.Szépe) Date: 2014-05-23 22:59
Python 2.7.6 (default, May 22 2014, 00:19:36)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from email.mime.multipart import MIMEMultipart
>>> new_msg = MIMEMultipart('alternative')
>>> new_msg.set_charset('us-ascii')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/python/lib/python2.7/email/message.py", line 268, in set_charset
    cte(self)
  File "/opt/python/lib/python2.7/email/encoders.py", line 73, in encode_7or8bit
    orig.encode('ascii')
AttributeError: 'list' object has no attribute 'encode'
>>>


I know it is not necessary.
How come that
new_msg.set_charset('us-ascii')
works?
msg219010 - (view) Author: Viktor Szépe (Viktor.Szépe) Date: 2014-05-23 23:01
Sorry!

How come that
new_msg.set_charset('utf-8')
works?
msg219607 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-06-02 17:20
I suspect this is either related to or is a duplicate of issue 1823.
History
Date User Action Args
2018-07-11 07:35:51serhiy.storchakasettype: crash -> behavior
2014-06-02 17:20:22r.david.murraysetmessages: + msg219607
2014-05-23 23:01:47Viktor.Szépesetmessages: + msg219010
2014-05-23 22:59:43Viktor.Szépecreate