read string as a file using io.StringIO
<p>I need to make a string to be read by <code>bibtexparser</code>'s <code>parsing_read</code>. As far as I understood the module, it only reads file, not stream, so I have done:</p>

<pre><code>text = "Some text"
with open("/tmp/bibtmp.bib", "w") as bibfile:
    bibfile.write(text)
self.parsing.parsing_read("/tmp/bibtmp.bib")
</code></pre>

<p>But, I am trying to  make it read the string, and trying <code>io.StringIO</code> module as:</p>

<pre><code>fakefile = io.StringIO("SomeText")
self.parsing.parsing_read(fakefile)
</code></pre>

<p>which is giving error(from the self.parsing.parsing_read, which opens the file):</p>

<pre><code>TypeError: invalid file: &lt;_io.StringIO object at 0x7fb4d6537ca8&gt;
</code></pre>

<p>So, obviously, fakefile is <code>io.StringIO</code>, and not a <code>Fake</code>file.</p>

<p>Am I understanding <code>io.StringIO</code>'s purpose wrong? or just doing it wrong?</p>