I've finished problem 10 in ps_5 and passed all the tests in the test harness, but when I run ps_5.py it doesn't return stories it just keeps looping printing "Polling"..."Sleeping"... I'm using WinXP and IDLE
Could you dpaste or pastebin your code, I'll take a look at it.
@osdsb I added (import pprint) at the top in the imports section so I could print out the stories object and see how it changed as it went through main() Then, commented out everything in the main function and started uncommenting a line at a time from the top, pprinting stories each time it changed: # Get stories from Google's Top Stories RSS news feed stories = process(" http://news.google.com/?output=rss ") pprint.pprint(stories) # Get stories from Yahoo's Top Stories RSS news feed stories.extend(process(" http://rss.news.yahoo.com/rss/topstories ")) pprint.pprint(stories) # Only select stories we're interested in stories = filter_stories(stories, triggerlist) pprint.pprint(stories) What I found is that after you run filter_stories, stories ends up empty ... everything gets filtered out of it, that's why you're not getting any output there. Your issue is in Part 3 Filtering Near the end of: def filter_stories(stories, triggerlist): If I comment out these two lines in the stories loop, it starts working: for story in stories: ## for trig in triggerlist: ## if trig.evaluate(story): filteredStories.append(story) return filteredStories
hmm...interesting. You're right. But if I take those lines out then the test harness fails. http://dpaste.com/787422/ I'm stuck in my own real life programming loop! Thanks for the help, I'll see what I can do.
ok, i think my code is correct and working properly. None of the trigger words actually appear in the fields searched so all the entries were filtered out. I changed the search terms and it gave me results.
Awesome :)
Join our real-time social learning platform and learn together with your friends!