title: lxml etree.iterparse error "TypeError: reading file objects must return plain strings"
body: <p>I would like to parse an HTML document using lxml. I am using python 3.2.3 and lxml 2.3.4 ( <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml" rel="noreferrer">http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml</a> )</p>
  
  <p>I am using the <code>etree.iterparse</code> to parse the document, but it returns the following run-time error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "D:\Eclipse Projects\Python workspace\Crawler\crawler.py", line 12, in &lt;module&gt;
      for event, elements in etree.iterparse(some_file_like):
    File "iterparse.pxi", line 491, in lxml.etree.iterparse.__next__ (src/lxml\lxml.etree.c:98565)
    File "iterparse.pxi", line 512, in lxml.etree.iterparse._read_more_events (src/lxml\lxml.etree.c:98768)
  TypeError: reading file objects must return plain strings
  </code></pre>
  
  <p>The question is: How to solve this run-time error?</p>
  
  <p>Thank you very much.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>from io import StringIO
  from lxml import etree
  
  some_file_like = StringIO("&lt;root&gt;&lt;a&gt;data&lt;/a&gt;&lt;/root&gt;")
  
  for event, elements in etree.iterparse(some_file_like): #&lt;-- Run-time error happens here
      print("%s, %4s, %s" % (event, elements.tag, elements.text))
  </code></pre>