View Single Post
Old 07-27-2012, 09:14 AM   #4
cryzed
Evangelist
cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.cryzed ought to be getting tired of karma fortunes by now.
 
cryzed's Avatar
 
Posts: 408
Karma: 1050547
Join Date: Mar 2011
Device: Kindle Oasis 2
PHP Code:
for post in section.findAll(attrs={'class':'package-link'}): 
You are missing the tag argument when you call "section.findAll". It should look like this:
PHP Code:
for post in section.findAll('a', {'class''package-link'}): 
Also using the "attrs" keyword parameter is not needed in this case, just do your calls without them. Additionally the line that checks "if post is None" will never equal true, or at least should not, you should be able to remove that statement entirely.

In case this is just a bug that you introduced while trying to find the actual mistake I suggest you check all your control structures that cause the current loop to continue prematurely, meaning: print the variables you are checking against and see what their value is, this will hopefully show you where and why the unexpected behavior occurs.

Something else I noticed is that when you filter the tags by their class name you sometimes pass a list instead of a simple string, i.e. like you did in your original post -- this is not needed and I'm not sure if it even works. (I mean the square brackets around e.g. "package-link")

Last edited by cryzed; 07-27-2012 at 09:39 AM.
cryzed is offline   Reply With Quote