Writing files

Jerry Hill malaclypse2 at gmail.com
Mon Mar 19 15:56:15 EDT 2007


On 3/19/07, Adonis Vargas <adonis at removethisearthlink.net> wrote:
> Actually, I re-ran this in a terminal and it worked perfectly. I was
> using IDLE to write this code, kinda peculiar. Maybe something to do
> with IDLE and CSV (or writing to files) with lines > ~1000. A socket
> timing out maybe?

It's because your file never got closed.  When you ran the script from
the terminal, your file was automatically closed when outCSV was
garbage collected.  When you ran your script in IDLE outCSV was still
a live variable, so it wasn't garbage collected automatically.  Since
you never told it to close the file, there was still data sitting in
the buffer waiting to be written.

-- 
Jerry



More information about the Python-list mailing list