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
MIT 6.00 Intro Computer Science (OCW)
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
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")
# Get stories from Yahoo's Top Stories RSS news feed
# Only select stories we're interested in
stories = filter_stories(stories, triggerlist)
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):
Not the answer you are looking for? Search for more explanations.
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.