I am new to python…you are warned.
I copied an example from http://wiki.python.org/moin/RssLibraries but I keep getting the error
"future_calls = [Future(feedparser.parse,rss_url) for rss_url in hit_list]
TypeError: __init__() takes exactly 1 argument (3 given)"
Here is my code:
import feedparser
from futures import Future
hit_list = [ "http://feeds.reuters.com/news/artsculture", "http://feeds.reuters.com/reuters/healthNews" ] # list of feeds to pull down
# pull down all feeds
future_calls = [Future(feedparser.parse,rss_url) for rss_url in hit_list]
# block until they are all in
feeds = [future_obj() for future_obj in future_calls]
entries = []
for feed in feeds:
entries.extend( feed[ "item" ] )
sorted_entries = sorted(entries, key=lambda entry: entry["title"])
print sorted_entries
Are you sure you’re using the right modules? You have:
but if you mean to use the module from the RssLibraries page you linked to, then it should be
(and you’ll need to download the
futuremodule from the link on that page).It looks like you’re actually using the futures module which is a back port of the Python 3
concurrent.futuresmodule for earlier version of Python.