当我 run倒时,或当我用我手写的字眼时,它就失败了:
ascii codec can t decode byte 0xe2 in position 32: ordinal not in range(128)
我不知道为什么,但当我简单地用同样的ur子执行 feed(url)声明时,没有发现任何错误。 这给我留下了很长的时间。
该法典简单明了:
try:
d = feedparser.parse(url)
except Exception, e:
logging.error( Error while retrieving feed. )
logging.error(e)
logging.error(formatExceptionInfo(None))
logging.error(formatExceptionInfo1())
这里的痕迹是:
d = feedparser.parse(url)
File "C:Python26libsite-packagesfeedparser.py", line 2623, in parse
feedparser.feed(data)
File "C:Python26libsite-packagesfeedparser.py", line 1441, in feed
sgmllib.SGMLParser.feed(self, data)
File "C:Python26libsgmllib.py", line 104, in feed
self.goahead(0)
File "C:Python26libsgmllib.py", line 143, in goahead
k = self.parse_endtag(i)
File "C:Python26libsgmllib.py", line 320, in parse_endtag
self.finish_endtag(tag)
File "C:Python26libsgmllib.py", line 360, in finish_endtag
self.unknown_endtag(tag)
File "C:Python26libsite-packagesfeedparser.py", line 476, in unknown_endtag
method()
File "C:Python26libsite-packagesfeedparser.py", line 1318, in _end_content
value = self.popContent( content )
File "C:Python26libsite-packagesfeedparser.py", line 700, in popContent
value = self.pop(tag)
File "C:Python26libsite-packagesfeedparser.py", line 641, in pop
output = _resolveRelativeURIs(output, self.baseuri, self.encoding)
File "C:Python26libsite-packagesfeedparser.py", line 1594, in _resolveRelativeURIs
p.feed(htmlSource)
File "C:Python26libsite-packagesfeedparser.py", line 1441, in feed
sgmllib.SGMLParser.feed(self, data)
File "C:Python26libsgmllib.py", line 104, in feed
self.goahead(0)
File "C:Python26libsgmllib.py", line 138, in goahead
k = self.parse_starttag(i)
File "C:Python26libsgmllib.py", line 296, in parse_starttag
self.finish_starttag(tag, attrs)
File "C:Python26libsgmllib.py", line 338, in finish_starttag
self.unknown_starttag(tag, attrs)
File "C:Python26libsite-packagesfeedparser.py", line 1588, in unknown_starttag
attrs = [(key, ((tag, key) in self.relative_uris) and self.resolveURI(value) or value) for key, value in attrs]
File "C:Python26libsite-packagesfeedparser.py", line 1584, in resolveURI
return _urljoin(self.baseuri, uri)
File "C:Python26libsite-packagesfeedparser.py", line 286, in _urljoin
return urlparse.urljoin(base, uri)
File "C:Python26liburlparse.py", line 215, in urljoin
params, query, fragment))
File "C:Python26liburlparse.py", line 184, in urlunparse
return urlunsplit((scheme, netloc, url, query, fragment))
File "C:Python26liburlparse.py", line 192, in urlunsplit
url = scheme + : + url
File "C:Python26libencodingscp1252.py", line 15, in decode
return codecs.charmap_decode(input,errors,decoding_table)
部分内容:
当通过URL作为单编码时,这一点是可以再使用的。 当它 s一旁时,它就获得了回升。 为记录起见,您需要一种具有一定高度特性的统一编码特性的馈赠。 我不清楚为什么如此。