I researched this a while back.  I think I found a fix for this that Alexandre Ratti posted to an email group.
 
He said:
 
[quote start]
I suspect that the crash occur because these messages have multipart
boundaries but have a text content type header. This cause the
"_handle_text" method of the Generator class (in email/Generator.py) to
be called. This method expects get_payload() to return a string, which
doesn't happen since the message is multipart.
[quote end]
 
To fix this, I changed the _handle_text method in TMDA/pythonlib/email/Generator.py to this as suggested by Alexandre:
 
    def _handle_text(self, msg):
        payload = msg.get_payload()
        if payload is None:
            return
        cset = msg.get_charset()
        if cset is not None:
            payload = cset.body_encode(payload)
        if not _isstring(payload):
            # AGW start
            # Changed to handle malformed messages with a text base
            # type and a multipart content
            if type(payload) == type([]) and msg.is_multipart():
                return self._handle_multipart(msg)
            else:
                raise TypeError, 'string payload expected: %s' % type(payload)
            # AGW end
        if self._mangle_from_:
            payload = fcre.sub('>From ', payload)
        self._fp.write(payload)
 
Hope it helps!
 
 
----- Original Message -----
Sent: Wednesday, August 04, 2004 11:21 PM
Subject: TypeError: string payload expected: <type 'list'>

I've been receiving this error since 1.0 and am currently using
the snapshot tmda-UNSTABLE-20040721 freshly installed not upgraded.

Can someone please tell me how to stop this error?

Uncaught Python 2.3.2 Exception (Wed Aug  4 15:57:24 2004):
-----------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/kai/tmda/bin/tmda-filter", line 53, in ?
    execfile(os.path.join(execdir, 'tmda-rfilter'))
  File "/usr/home/kai/tmda/bin/tmda-rfilter", line 860, in ?
    main()
  File "/usr/home/kai/tmda/bin/tmda-rfilter", line 814, in main
    bouncegen('bounce', 'bounce_incoming.txt')
  File "/usr/home/kai/tmda/bin/tmda-rfilter", line 737, in bouncegen
    send_bounce(bounce_message, mode)
  File "/usr/home/kai/tmda/bin/tmda-rfilter", line 444, in send_bounce
    ar.send()
  File "./TMDA/AutoResponse.py", line 226, in send
  File "./TMDA/Util.py", line 560, in msg_as_string
  File "./TMDA/pythonlib/email/Generator.py", line 103, in flatten
  File "./TMDA/pythonlib/email/Generator.py", line 131, in _write
  File "./TMDA/pythonlib/email/Generator.py", line 157, in _dispatch
  File "./TMDA/pythonlib/email/Generator.py", line 231, in _handle_multipart
  File "./TMDA/pythonlib/email/Generator.py", line 103, in flatten
  File "./TMDA/pythonlib/email/Generator.py", line 131, in _write
  File "./TMDA/pythonlib/email/Generator.py", line 157, in _dispatch
  File "./TMDA/pythonlib/email/Generator.py", line 298, in _handle_message
  File "./TMDA/pythonlib/email/Generator.py", line 103, in flatten
  File "./TMDA/pythonlib/email/Generator.py", line 131, in _write
  File "./TMDA/pythonlib/email/Generator.py", line 157, in _dispatch
  File "./TMDA/pythonlib/email/Generator.py", line 200, in _handle_text
TypeError: string payload expected: <type 'list'>

--
 kai

_____________________________________________
tmda-users mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-users

Reply via email to