[ python-Bugs-954320 ] New email pkg FeedParser croaks on some spam

SourceForge.net noreply at sourceforge.net
Sat May 15 12:28:17 EDT 2004


Bugs item #954320, was opened at 2004-05-15 00:19
Message generated for change (Comment added) made by bwarsaw
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=954320&group_id=5470

Category: Python Library
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Barry A. Warsaw (bwarsaw)
Summary: New email pkg FeedParser croaks on some spam

Initial Comment:
After cvs up today, the Spambayes sb_filter.py app
croaks on the attached spam (spam10).  I suspect
it's got something to do with the new FeedParser
in the email package.

Running 'sb_filter.py spam10' I get this traceback:

Traceback (most recent call last):
  File "/Users/skip/local/bin/sb_filter.py", line 257, in ?
    main()
  File "/Users/skip/local/bin/sb_filter.py", line 245, in main
    mbox = mboxutils.getmbox(fname)
  File "/Users/skip/local/lib/python2.4/site-packages/
spambayes/mboxutils.py", line 66, in getmbox
    return [get_message(sys.stdin)]
  File "/Users/skip/local/lib/python2.4/site-packages/
spambayes/mboxutils.py", line 129, in get_message
    msg = email.message_from_string(obj)
  File "/Users/skip/local/lib/python2.4/email/__init__.py", 
line 45, in message_from_string
    return Parser(_class, strict=strict).parsestr(s)
  File "/Users/skip/local/lib/python2.4/email/Parser.py", line 
67, in parsestr
    return self.parse(StringIO(text), 
headersonly=headersonly)
  File "/Users/skip/local/lib/python2.4/email/Parser.py", line 
56, in parse
    feedparser.feed(data)
  File "/Users/skip/local/lib/python2.4/email/FeedParser.py", 
line 145, in feed
    self._call_parse()
  File "/Users/skip/local/lib/python2.4/email/FeedParser.py", 
line 149, in _call_parse
    self._parse()
  File "/Users/skip/local/lib/python2.4/email/FeedParser.py", 
line 317, in _parsegen
    mo = boundaryre.match(line)
TypeError: expected string or buffer

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

>Comment By: Barry A. Warsaw (bwarsaw)
Date: 2004-05-15 12:28

Message:
Logged In: YES 
user_id=12800

Actually, I won't add a test case for this one -- it'll
happens because of the 8092 byte blocking factor of
Parser.parse().


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

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2004-05-15 12:18

Message:
Logged In: YES 
user_id=12800

That's exactly the right fix -- I have the same one waiting
to be checked in, but I've been trying to boil down the
example so I can add it to the test suite.

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

Comment By: Skip Montanaro (montanaro)
Date: 2004-05-15 11:59

Message:
Logged In: YES 
user_id=44345

After looking at the source, this error seems to be pretty
shallow.  Attached is FeedParser.diff, which seems to 
fix the problem.


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

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



More information about the Python-bugs-list mailing list