This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sdaoden
Recipients r.david.murray, sdaoden
Date 2011-03-15.13:43:40
SpamBayes Score 1.1657342e-15
Marked as misclassified No
Message-id <20110315134246.GA4532@sherwood.local>
In-reply-to <1300162883.48.0.67042836204.issue11243@psf.upfronthosting.co.za>
Content
On Tue, Mar 15, 2011 at 04:21:24AM +0000, R. David Murray wrote:
> Please test and let me know if it works; it should, since the code patch is very close to the one you suggested.

;-)
Hello David, hope you have a good time at Pycon! 
(Just Googled, weather will be fine right after all of you 
will see the sun and the blue sky once again! 
Hey -- there is a world out there!! :)

Just like i've stated on EMAIL-SIG, you really have convinced me 
of simply using the binary feedparser, but since you have found 
even more places where explicit str() is necessary, this package 
is once again at least 50% better than before!

But i've readded a
    email.header.make_header(email.header.decode_header(b))
thing in my Ticket._bewitch_msg() and ran that patched S-Postman 
;=) on an 3.8 MB mbox file (by the way, if you need f..d .. 
emails, subscribe to OpenBSD Misc), and i'll end up like this:

Traceback (most recent call last):
  File "/Users/steffen/usr/bin/s-postman.py", line 1815, in _walk
    self._tickets.extend(Ticket.process_message(msg))
  File "/Users/steffen/usr/bin/s-postman.py", line 1671, in process_message
    return [Ticket(m, _targets=rsm.targets) for m in splitter]
  File "/Users/steffen/usr/bin/s-postman.py", line 1671, in <listcomp>
    return [Ticket(m, _targets=rsm.targets) for m in splitter]
  File "/Users/steffen/usr/bin/s-postman.py", line 1681, in __init__
    self._bewitch_msg()
  File "/Users/steffen/usr/bin/s-postman.py", line 1752, in _bewitch_msg
    self._msg[n] = email.header.make_header(email.header.decode_header(b))
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 73, in decode_header
    if not ecre.search(header):
Exception: TypeError: expected string or buffer

Here: header==<class 'email.header.Header'>
And:

Traceback (most recent call last):
  File "/Users/steffen/usr/bin/s-postman.py", line 1815, in _walk
    self._tickets.extend(Ticket.process_message(msg))
  File "/Users/steffen/usr/bin/s-postman.py", line 1671, in process_message
    return [Ticket(m, _targets=rsm.targets) for m in splitter]
  File "/Users/steffen/usr/bin/s-postman.py", line 1671, in <listcomp>
    return [Ticket(m, _targets=rsm.targets) for m in splitter]
  File "/Users/steffen/usr/bin/s-postman.py", line 1681, in __init__
    self._bewitch_msg()
  File "/Users/steffen/usr/bin/s-postman.py", line 1752, in _bewitch_msg
    self._msg[n] = email.header.make_header(email.header.decode_header(b))
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 154, in make_header
    h.append(s, charset)
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 270, in append
    s = s.decode(input_charset, errors)
Exception: AttributeError: 'Header' object has no attribute 'decode'

Here s==<class 'email.header.Header'>
And after adding
        # Steffen is out now
        if isinstance(s, email.header.Header):
            s = str(s)
i got stuck on this:

Traceback (raising call only):
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 278, in append
    s.encode(output_charset, errors)
Exception: UnicodeEncodeError: 'ascii' codec can't encode character '\ufffd' in position 7: ordinal not in range(128)
{Aaaargh!  Special case UNICODE replacement character, mongrel!}

s was a Header here, too.
I apply a simple email_header.diff which applies cleanly to a49bda. 
Hope i could help a bit.
Files
File name Uploaded
email_header.diff sdaoden, 2011-03-15.13:43:40
History
Date User Action Args
2011-03-15 13:43:41sdaodensetrecipients: + sdaoden, r.david.murray
2011-03-15 13:43:40sdaodenlinkissue11243 messages
2011-03-15 13:43:40sdaodencreate