minichiello / PyOpenGraph

PyOpenGraph is a library written in Python for parsing Open Graph protocol information from web sites.

Home Page:http://pypi.python.org/pypi/PyOpenGraph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 14: ordinal not in range(128)

bashi-bazouk opened this issue · comments

This occurs after a second request for a pages returns something which PyOpenGraph cannot parse.

This particular bug in a dependent library is documented here: http://stackoverflow.com/questions/6839922/unicodedecodeerror-is-raised-when-getting-a-cookie-in-google-app-engine

Trace:

File "/home/dependencies/PyOpenGraph-0.2/PyOpenGraph/PyOpenGraph.py", line 42, in init
p.feed(contents)
File "/usr/local/lib/python2.7/HTMLParser.py", line 108, in feed
self.goahead(0)
File "/usr/local/lib/python2.7/HTMLParser.py", line 148, in goahead
k = self.parse_starttag(i)
File "/usr/local/lib/python2.7/HTMLParser.py", line 252, in parse_starttag
attrvalue = self.unescape(attrvalue)
File "/usr/local/lib/python2.7/HTMLParser.py", line 393, in unescape
return re.sub(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));", replaceEntities, s)
File "/usr/local/lib/python2.7/re.py", line 151, in sub
return _compile(pattern, flags).sub(repl, string, count)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 14: ordinal not in range(128)