View Single Post
Old 01-26-2014, 05:29 PM   #4
geekraver
Addict
geekraver ought to be getting tired of karma fortunes by now.geekraver ought to be getting tired of karma fortunes by now.geekraver ought to be getting tired of karma fortunes by now.geekraver ought to be getting tired of karma fortunes by now.geekraver ought to be getting tired of karma fortunes by now.geekraver ought to be getting tired of karma fortunes by now.geekraver ought to be getting tired of karma fortunes by now.geekraver ought to be getting tired of karma fortunes by now.geekraver ought to be getting tired of karma fortunes by now.geekraver ought to be getting tired of karma fortunes by now.geekraver ought to be getting tired of karma fortunes by now.
 
Posts: 364
Karma: 1035291
Join Date: Jul 2006
Location: Redmond, WA
Device: iPad Mini,Kindle Paperwhite
Are there any known issues with the Beautiful Soup that is bundled with Calibre? I'm finding that from within my plugin, a soup.find(class_="foo") is returning None, while in my test script hitting the same URL it works and finds the div I want. I logged the page contents and they look fine so everything seems to be working up to the point I call find (I can copy the metadata log to the clipboard and paste it in an editor and see the element that the find failed to locate).

EDIT: I notice that doing finds by id seems to work, but not finds by class.

EDIT: the above was the key. The soup distributed with Calibre is an older version that doesn't support the class_ parameter. Instead you must use:

find(attrs={'class':'foo'})

Last edited by geekraver; 01-26-2014 at 06:39 PM.
geekraver is offline   Reply With Quote