title: How can I resolve TypeError with StringIO in Python 2.7?
body: <p>Trying to read following string as file using <code>StringIO</code> but getting the error below. How can I resolve it?</p>
  
  <pre><code>&gt;&gt; from io import StringIO
  &gt;&gt;&gt;
  &gt;&gt;&gt; datastring = StringIO("""\
  ... Country  Metric           2011   2012   2013  2014
  ... USA     GDP               7      4     0      2
  ... USA     Pop.              2      3     0      3
  ... GB      GDP               8      7     0      7
  ... GB      Pop.              2      6     0      0
  ... FR      GDP               5      0     0      1
  ... FR      Pop.              1      1     0      5
  ... """)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 9, in &lt;module&gt;
  TypeError: initial_value must be unicode or None, not str
  </code></pre>