email: msg.add_payload not synonymous with msg.attach?

Magnus Lie Hetland mlh at vier.idi.ntnu.no
Thu Jun 6 20:01:10 EDT 2002


I've been fiddling with the email package, and tried to construct a
Message object, using add_payload to add the email body (It's a
text/plain message). This worked fine, except for a deprecation
warning telling me to use attach instead. But when I did, my program
crashed with the message "TypeError: string payload expected: <type
'list'>" (from Generator.py). Well... My payload was indeed simply a
string, so I don't understand the error message. Also, I don't
understand how this discrepancy could have occurred if, as the docs
claim, add_payload and attach are synonymous.

(The code is very simple -- basically just instantiating Message and
adding a payload.)

I'm using the email package from CVS (downloaded everything a day or
two ago).

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org



More information about the Python-list mailing list