BeautifulSoup error
William Xu
william.xwl at gmail.com
Thu Jun 15 23:33:31 EDT 2006
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
self.rawdata = self.rawdata + data
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb8 in position 565: ordinal not in range(128)
>>>
Any ideas to solve this?
version info:
Python 2.3.5 (#2, Mar 7 2006, 12:43:17)
[GCC 4.0.3 20060212 (prerelease) (Debian 4.0.2-9)] on linux2
python-beautifulsoup: 3.0.1-1
--
William
"I'd love to go out with you, but I have to floss my cat."
More information about the Python-list
mailing list