BeautifulSoup error

Serge Orlov Serge.Orlov at gmail.com
Fri Jun 16 19:56:35 CEST 2006


William Xu wrote:
> Hi, all,
>
> This piece of code used to work well. i guess the error occurs after
> some upgrade.
>
> >>> import urllib
> >>> from BeautifulSoup import BeautifulSoup
> >>> url = 'http://www.google.com'
> >>> port = urllib.urlopen(url).read()
> >>> soup = BeautifulSoup()
> >>> soup.feed(port)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/python2.3/sgmllib.py", line 94, in feed

Look at the traceback: you're not calling BeautifulSoup module! In
fact, there is no feed method in the current BeautifulSoup
documentation. Maybe it used to work well, but now it's definitely
going to fail. As I understand documentation you need to write

soup = BeautifulSoup(port)




More information about the Python-list mailing list