feedparser: Error while setting up platform feedparser - seems to be GeoRSS related
HA version - 88.2 feedparser.py version - 0.0.4
Feedparser fails w/ following error:
2019-03-17 14:13:29 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform feedparser
Traceback (most recent call last):
File "/config/deps/lib/python3.7/site-packages/feedparser.py", line 3766, in _gen_georss_coords
t = [nxt(), nxt()][::swap and -1 or 1]
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/feedparser/sensor.py", line 46, in setup_platform
add_devices([FeedParserSensor(hass, config)])
File "/config/custom_components/feedparser/sensor.py", line 58, in __init__
self.update()
File "/config/custom_components/feedparser/sensor.py", line 62, in update
parsedFeed = feedparser.parse(self._feed)
File "/config/deps/lib/python3.7/site-packages/feedparser.py", line 3956, in parse
saxparser.parse(source)
File "/usr/local/lib/python3.7/xml/sax/expatreader.py", line 111, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/local/lib/python3.7/xml/sax/xmlreader.py", line 125, in parse
self.feed(buffer)
File "/usr/local/lib/python3.7/xml/sax/expatreader.py", line 217, in feed
self._parser.Parse(data, isFinal)
File "/usr/src/python/Modules/pyexpat.c", line 471, in EndElement
File "/usr/local/lib/python3.7/xml/sax/expatreader.py", line 381, in end_element_ns
self._cont_handler.endElementNS(pair, None)
File "/config/deps/lib/python3.7/site-packages/feedparser.py", line 2052, in endElementNS
self.unknown_endtag(localname)
File "/config/deps/lib/python3.7/site-packages/feedparser.py", line 696, in unknown_endtag
method()
File "/config/deps/lib/python3.7/site-packages/feedparser.py", line 1463, in _end_georss_point
geometry = _parse_georss_point(self.pop('geometry'))
File "/config/deps/lib/python3.7/site-packages/feedparser.py", line 3775, in _parse_georss_point
coords = list(_gen_georss_coords(value, swap, dims))
RuntimeError: generator raised StopIteration
Here is the XML it was attempting to parse; I did validate this XML against an online validator and it passed, but maybe there’s something in there that might help so I’m including it.
<rss xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>Active Incidents</title>
<description>All Active Incidents</description>
<language>en-us</language>
<pubDate>Sun, 17 Mar 2019 14:22:09 -0400</pubDate>
<copyright>Copyright 511nj.org</copyright>
<ttl>1</ttl>
<atom:link type="application/rss+xml" rel="self" href="https://siftrss.com/f/rM97xqQppx"/>
<item>
<title>NJ 21 northbound : Watermain break</title>
<description>
NJ DOT - STMC: Watermain break on NJ 21 northbound area of I-280 (Newark) all lanes open to traffic
</description>
<pubDate>Sun, 17 Mar 2019 13:39:29 -0400</pubDate>
<georss:point>40.7473097576 -74.1674443187</georss:point>
</item>
<item>
<title>
New Jersey Turnpike/I-95 northbound : Disabled vehicle
</title>
<description>
NJ Turnpike Auth.: Disabled vehicle on New Jersey Turnpike/I-95 express lanes northbound South of Exit 71 (NB) - NJ 4/Broad Ave (Teaneck Twp) right lane blocked
</description>
<pubDate>Sun, 17 Mar 2019 13:33:00 -0400</pubDate>
<georss:point>40.8737688181 -73.9957312183</georss:point>
</item>
<item>
<title>
New Jersey Turnpike - Eastern Spur northbound : Accident
</title>
<description>
NJ Turnpike Auth.: Accident on New Jersey Turnpike - Eastern Spur northbound North of Interchange 15W - I-280 (Kearny) center lane blocked
</description>
<pubDate>Sun, 17 Mar 2019 13:59:32 -0400</pubDate>
<georss:point>40.7554488245 -74.1060449598</georss:point>
</item>
</channel>
</rss>
I tried deleting the deps folder to allow it to rebuild in case there was a version issue or corruption but it didn’t seem to help; on first boot I didn’t get the error but it returned immediately on the next restart afterwards.
I am restoring things from a previous backup and this is the only thing left that I haven’t been able to figure out on my own. It was working previously for me. I also double checked the config of the sensor itself and it seems valid. I even tried excluding the georss:point data from the sensor, but after restart I got the same exact error.
Here’s the config:
- platform: feedparser
name: Traffic Incidents
#Source RSS - http://511nj.org/RSS511Service/RSS511Service.svc/rest/rss/RSSActiveIncidents
feed_url: https://siftrss.com/f/rM97xqQppx
exclusions:
- georss:point
I’m kinda out of my realm of knowledge at this point and I was hoping that you might be able to take a look and either point me in the right direction or advise a solution. I’d really hate to have to stop using FeedParser as I still want to use it elsewhere; I recently got my WeeWx weather station running on a spare Pi and was hoping to pull the feed on it into HA.
Thanks for your time and effort!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 31 (14 by maintainers)
well I still plan on doing a full re-write of it…someday 😄 i’ll leave this open until I update the dependency
It doesn’t seem to be an issue anymore. I also updated the manifest.json to pull the newest beta release of McKee’s feedparser lib (6.0.0b1) and that works as well. I can’t get it to display in List Card because the data is nested and I can’t figure out the proper syntax, but it is showing in the sensor and I no longer have to exclude it.
Yo, just for shits and giggles, I downloaded the hotfix and replaced the release version in /deps/ (actually renamed it cause I wanted to save it in case things went South on me) and the damn thing works! This eliminates the issue I was having and I am back in business. Guy even furnished a bash script in the post that downloads the hotfix and overwrites the installed feedparser.py!
Thanks again for your help, Ian.