* Joey Hess <[EMAIL PROTECTED]> [2005-04-05 19:41]:
> >   File "/usr/share/rss2email/html2text.py", line 280, in handle_tag
> >     self.list.pop()
> > IndexError: pop from empty list
> Confirmed the bug and I'll attach a copy of the feed.

Thanks for keeping a copy of the feed.  The problem doesn't show with
the current version.  Basically, the problem is a bug in the HTML of
the feed:

  <p>More ANPR camera technology is unjustifiable if there are even fewer
  actual Traffic Police patrols on the road.</p>

  <blockquote><li>"Using hypothecated income from Fixed Penalty Notices
  resulting from ANPR activity to fund further ANPR
  development"</ul></blockquote>

You see that the second paragraph closes an <ul> element but it never
actually opens one.  rss2email seens the closing </ul> and wants to
get rid of the opening <ul> but that fails because the list is empty.

Some debugging shows how rss2email sees this portion of the feed:

p
[]
1

p
None
0

blockquote
[]
1

li
[]
1

ul
None
0


start is None so it will try to remove an item from the list.
However, as you can see in the paragraph above (li), the list is
emtpy.  So popping from there is Not a Good Idea(tm).  I think the
appropriate patch is:


--- html2text.py~       2005-05-23 22:46:45.983858424 +0100
+++ html2text.py        2005-05-23 22:46:55.402426584 +0100
@@ -276,7 +276,7 @@
                if tag in ["ol", "ul"]:
                        if start:
                                self.list.append({'name':tag, 'num':0})
-                       else:
+                       elif self.list:
                                self.list.pop()
                        
                        self.p()

I suppose the same problem might occur in other parts of html2text.py
but I didn't check.
-- 
Martin Michlmayr
http://www.cyrius.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to