Package: rss2email
Version: 1:2.71-2
Tags: patch

Ola Lindsey & DebianBuggers,

I sometimes have a feed which generates:

-----------------------------
=== rss2email encountered a problem with this feed ===
=== See the rss2email FAQ at http://www.allthingsrss.com/rss2email/ for 
assistance ===
=== If this occurs repeatedly, send this to lind...@allthingsrss.com ===
E: could not parse http://soup.nibbler.tv/rss
Traceback (most recent call last):
  File "/usr/share/rss2email/rss2email.py", line 711, in run
    tagline = ",".join(taglist)
TypeError: sequence item 1: expected string or Unicode, NoneType found
rss2email 2.71
feedparser 5.1.3
html2text 3.200.3
Python 2.7.6 (default, Dec 30 2013, 14:37:40)
[GCC 4.8.2]
=== END HERE ===
-----------------------------

I don't know which exact line in the source RSS causes it, but it happens from 
time to time; likely some parse going wrong.

Inserting at line 710 a 'print taglist' results in:

[u'image', None]

Hence the attached simple patch filters out the "None" and voila things keep on 
working and I get my daily dose of silly pictures again thanks to nibbler ;)

Greets,
 Jeroen
--- rss2email.py        2014-01-06 00:35:13.652294000 +0100
+++ /usr/share/rss2email/rss2email.py   2014-01-06 00:34:10.056294000 +0100
@@ -707,7 +707,7 @@
                                                         for tag in tags:
                                                                 
taglist.append(tag['term'])
                                                 if taglist:
-                                                        tagline = 
",".join(taglist)
+                                                        tagline = 
",".join(filter(None, taglist))
                                         
                                         extraheaders = {'Date': datehdr, 
'User-Agent': useragenthdr, 'X-RSS-Feed': f.url, 'X-RSS-ID': id, 'X-RSS-URL': 
link, 'X-RSS-TAGS' : tagline}
                                         if BONUS_HEADER != '':

Reply via email to