ValueError: I/O operation on closed file - Already googled
<p>What is wrong with this error message? I googled for it and i still have no idea</p>

<p>This is where you open the file:</p>

<pre><code>with open("rofl.csv", "rb") as f, open("out.csv", "wb") as out:
</code></pre>

<p>The <code>with</code> block establishes the context. As soon as this context is left, the file will be closed. This:</p>

<pre><code>writer.writerow([id_, name, combinedaddress, dateprinter, timeprinter, ', '.join(ingredients), totalprinter.group(1)])
</code></pre>

<p>â¦is outside the <code>with</code> block. The file has been closed by the time the program reaches this statement, because the <code>with</code> block has ended.</p>

<p>Indent the <code>write.writerow</code> to be within the <code>with</code> block.</p>

python