[IPython-user] Files not closed under IPython?
mbk.lists at gmail.com
Sun Sep 17 19:46:38 CDT 2006
> You need to close your file descriptors yourself, python doesn't guarantee
> their closing at any particular time other than the interpreter's exit. Since
> in ipython, the python process hasn't died yet, your files aren't closed.
> When you start a fresh python process from the command line, that process
> finishes and all open files get closed.
> Get in the habit of closing any open files when you're done with them, if you
> want to avoid all kinds of hard-to-track bugs. This is not an ipython issue.
I thought that something like this was probably the issue.
Unfortunately, I was led astray by the examples both in the official
python docs and at effbot.org which show the csv writer being
constructed with a nested open call. I could not find a way to get to
the associated file object from the writer object. In order to
explicitly close, I'll have to do the construction in two steps.
Thanks for your help!
More information about the IPython-user