Note that there are some explanatory texts on larger screens.

plurals
  1. POBeautiful Soup raises UnicodeEncodeError "ordinal not in range(128)"
    primarykey
    data
    text
    <p>I am trying to parse arbitrary documents download from the wild web, and yes, I have no control of their content.</p> <p>Since <a href="http://www.crummy.com/software/BeautifulSoup/" rel="noreferrer"><em>Beautiful Soup won't choke if you give it bad markup...</em></a> I wonder why does it giving me those hick-ups when sometimes, <em>part</em> of the doc is malformed, and whether there is a way to make it resume to next readable portion of the doc, regardless of this error.</p> <p>The line where the error occurred is the 3rd one:</p> <pre><code>from BeautifulSoup import BeautifulSoup as doc_parser reader = open(options.input_file, "rb") doc = doc_parser(reader) </code></pre> <p>CLI full output is:</p> <pre><code>Traceback (most recent call last): File "./grablinks", line 101, in &lt;module&gt; sys.exit(main()) File "./grablinks", line 88, in main links = grab_links(options) File "./grablinks", line 36, in grab_links doc = doc_parser(reader) File "/usr/local/lib/python2.7/dist-packages/BeautifulSoup.py", line 1519, in __init__ BeautifulStoneSoup.__init__(self, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/BeautifulSoup.py", line 1144, in __init__ self._feed(isHTML=isHTML) File "/usr/local/lib/python2.7/dist-packages/BeautifulSoup.py", line 1186, in _feed SGMLParser.feed(self, markup) File "/usr/lib/python2.7/sgmllib.py", line 104, in feed self.goahead(0) File "/usr/lib/python2.7/sgmllib.py", line 143, in goahead k = self.parse_endtag(i) File "/usr/lib/python2.7/sgmllib.py", line 320, in parse_endtag self.finish_endtag(tag) File "/usr/lib/python2.7/sgmllib.py", line 358, in finish_endtag method = getattr(self, 'end_' + tag) UnicodeEncodeError: 'ascii' codec can't encode characters in position 15-16: ordinal not in range(128) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload