Hi Aaron,
(I already replied but since it's not showing up i'll repeat.)
print span.string basically outputs AttributeError: 'NoneType' object
has no attribute 'string'.
Anyway afaik string is basically a convenience for contents[0]. See
the docs "For your convenience, if a tag has only one child node, and
that child node is a string, the child node is made available as
tag.string, as well as tag.contents[0].".
The response object might be truncated by GAE since when i do print
soup.prettify() the element i want is not there but printing the page
variable itself it's there. The strange thing is that checking the
attribute by the code below
if result.content_was_truncated:
print "TRUNCATED"
else:
print "NOT TRUNCATED"
I get NOT TRUNCATED so i'm at a bit of a loss. See
http://code.google.com/appengine/docs/python/urlfetch/responseobjects.html.
Any ideas?
On Dec 1, 7:44 pm, Aaron DeVore <
aaron.dev...@gmail.com> wrote:
> A little change there, for more useful output.
>
> span = soup.find('span', id='ctl00_PlaceHolderMain_lblDataRegisto')
> print span.string
>
> It *might* be useful to know the contents of Tag.string, hence the
> inclusion of that line and the 'print' statement.
>
> -Aaron
>
>
>
> On Tue, Dec 1, 2009 at 11:21 AM, Aaron DeVore <
aaron.dev...@gmail.com> wrote:
> > What happens when you download the file, parse it to a Beautiful Soup
> > tree, and run this?:
>
> > span = soup.find('span', id='ctl00_PlaceHolderMain_lblDataRegisto')
> > span.string
>
> > -Aaron DeVore
>
> > On Tue, Dec 1, 2009 at 9:40 AM, sofia cardita <
sofiacard...@gmail.com> wrote:
> >> Hi,
> >> If I do print page indeed the html from the page is printed and the span I'm
> >> looking for is there as well. Any ideas?
>
> >> On Tue, Dec 1, 2009 at 5:28 PM, Tal Einat <
talei...@gmail.com> wrote:
>
> >>> Never having used GAE I can't give a knowledgable answer, but my guess is
> >>> that in the first example your page variable doesn't hold precisely the text
> >>> you expect it to. Try printing it or comparing it to what you expect to get.
>