[ python-Bugs-1236906 ] email.Generator traceback in forwarded msg

SourceForge.net noreply at sourceforge.net
Sun Sep 18 23:31:44 CEST 2005


Bugs item #1236906, was opened at 2005-07-12 13:59
Message generated for change (Comment added) made by montanaro
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1236906&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Barry A. Warsaw (bwarsaw)
Summary: email.Generator traceback in forwarded msg

Initial Comment:
The SpamBayes sb_unheader app uses the email package
to dump out a copy of a message with user-specified
headers removed.  The email.Generator.Generator class is
barfing on the attached message.  I haven't had a chance
to look into it yet, but I suspect it's a problem in
the email
package, not the sb_unheader program.

Here's the traceback I see.  This is with a Python built
from CVS within the last couple days.

Traceback (most recent call last):
  File "/Users/skip/local/bin/sb_unheader.py", line
144, in ?
    main(sys.argv[1:])
  File "/Users/skip/local/bin/sb_unheader.py", line
139, in main
    process_mailbox(f, dosa, pats)
  File "/Users/skip/local/bin/sb_unheader.py", line 86,
in process_mailbox
    gen.flatten(msg, unixfrom=1)
  File
"/Users/skip/local/lib/python2.5/email/Generator.py",
line 82, in flatten    self._write(msg)
  File
"/Users/skip/local/lib/python2.5/email/Generator.py",
line 113, in _write    self._dispatch(msg)
  File
"/Users/skip/local/lib/python2.5/email/Generator.py",
line 139, in _dispatch
    meth(msg)
  File
"/Users/skip/local/lib/python2.5/email/Generator.py",
line 273, in _handle_message
    g.flatten(msg.get_payload(0), unixfrom=False)
  File
"/Users/skip/local/lib/python2.5/email/Message.py",
line 183, in get_payload
    raise TypeError('Expected list, got %s' %
type(self._payload))
TypeError: Expected list, got <type 'str'>
montanaro:tmp% type tradelink
tradelink is aliased to `ssh -C -X loginhost.trdlnk.com'


----------------------------------------------------------------------

>Comment By: Skip Montanaro (montanaro)
Date: 2005-09-18 16:31

Message:
Logged In: YES 
user_id=44345

Works for me now as well.  Apparently the problem's been fixed...
Close?


----------------------------------------------------------------------

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2005-09-18 16:15

Message:
Logged In: YES 
user_id=12800

This program works fine for me in Python 2.4 and 2.5:

import email

data = open('/tmp/newham').read()
msg = email.message_from_string(data)
print msg

Note that getting the str of the message will flatten it.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1236906&group_id=5470


More information about the Python-bugs-list mailing list