On Tue, Dec 28, 2010 at 07:02:04PM +0100, Andrzej Giniewicz wrote: > > Since f only needs to be closed if it has succesfully opened and thus > > did not raise IOError, I pushed a fix which puts f.close() inside the > > try statement. > > Thanks for applying! One thing though, what if file is open but fails > during read operation? like if it was edited by hand and there was a > mistake? We catch the exception then, but leave the file open?
IMO there was no need in the first place to close that file manually. When the file object gets garbage collected eventually, it will be closed. Even if it did not get closed, there would hardly be any harm done. And maybe use os.path.exists() instead of exception handling? This leaves exceptions for really unexpected stuff like harddisk failure. OK, and maybe I should try harder to shut up while you are getting work done and I am not :-) -- Martin Renold _______________________________________________ Mypaint-discuss mailing list [email protected] https://mail.gna.org/listinfo/mypaint-discuss
