[Tutor] How to open the closed file again?

Alan Gauld alan.gauld at btinternet.com
Wed Jan 6 01:11:20 CET 2010


"Luhmann" <luhmann_br at yahoo.com> wrote 

> When there are no more references to an open file object, 
> will it close, or the file will just remain open, forever unreachable?

Even if Python didn't close the file it would effectively be closed 
when the process stopped running. The OS should see to that.
(If it doesn't its not a very good OS! But there are a few bad 
OS out there...) So you shouldn't really ever wind up with a 
completely unreachable file due to it not being closed. Although 
it has happened to me in the past, I think most common OS 
should prevent that.

Alan G.



More information about the Tutor mailing list