I'm not sure if this is the place to submit bug reports.

I'm running IDLE 1.1.1 with Python 2.4.1 on Windows XP. It generally works well. (Using 2.4 because, last I checked, that was the latest I could use with PyGTK+.)

I'm running a simple application testing Beautiful Soup http://www.crummy.com/software/BeautifulSoup/

Source attached.

I get the following error message:

Traceback (most recent call last):
File "C:\a1\bin\Python24\dms\HTML_Parse\HTML_Parse.py", line 31, in -toplevel-
   print soup3.body.contents[0]
TypeError: 'NoneType' object is not callable



At first I assumed it was a bug in BeautifulSoup, but it turns out the script runs fine straight from the command line and under IPython, so it appears IDLE is at fault.

Apologies if this is an old bug fixed in 2.5.

David Stoner
"""

UTMB Directory Lookup

"""

from BeautifulSoup import BeautifulSoup
import re
from string import *
import urllib2


#name = ["David","Stoner"]
#fn = "+".join(name)
#url = 
"http://www.utmb.edu/directory/DirLookUp.asp?name="+fn+"&Submit=Find&type=name";
#url = "file:C:/a1/dms/DATA/WEBCT/CE6/newdata/070518/full/admin_server02.pl.htm"
url2 = 
"file:C:/a1/dms/DATA/WEBCT/CE6/newdata/070625/emr/FW%20%20more%20for%20web%20ct.eml.html"
url3="http://g35981/SamplePage.html";
page = urllib2.urlopen(url3)
soup3 = BeautifulSoup(page)
print type(soup3)
print soup3.__class__.__name__
print "::::::::::::::::::::::::::::::::::::::::"
print soup3.body.prettify()
#print soup.body.__class__.__name__
print "############"
print str(soup3.body)
print "############"
print soup3.body.renderContents
print "############"
print soup3.body.contents[0]
print "############"
print "############"
print "############"
b = soup3.body.ul.ul.contents[3]
print b
print ":::::::::::::::::::::::::::::::::"
hello = "Hello! <!--I've got to be nice to get what I want.-->"
commentSoup = BeautifulSoup(hello)
comment = commentSoup.find(text=re.compile("nice"))

print comment.__class__
# <class 'BeautifulSoup.Comment'>
print str(comment)
# u"I've got to be nice to get what I want."
print str(comment.previousSibling)
# u'Hello! '

doc = ['<html><head><title>Page title</title></head>',
       '<body><p id="firstpara" align="center">This is paragraph <b>one</b>.',
       '<p id="secondpara" align="blah">This is paragraph <b>two</b>.',
       '</html>']
soup = BeautifulSoup(''.join(doc))

pTag = soup.p
print pTag.contents
# [u'This is paragraph ', <b>one</b>, u'.']
print pTag.contents[1].contents
# [u'one']
# print pTag.contents[0]
Title: A Sample Page
A Sample Page

  • One potato
    • this
    • that
  • Two potato
    • tom
    • dick
_______________________________________________
IDLE-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/idle-dev

Reply via email to