raymond.hettinger wrote: > Author: raymond.hettinger > Date: Thu Feb 5 23:04:00 2009 > New Revision: 69314 > > Log: > Can't get tempfile to reliably delete on error and persist otherwise.
You work on Windows, don't you Raymond? What you were trying (setting tf.delete after the file was already open but before it was closed) would actually work on non-Windows platforms, since the delete flag is only checked in the close() method. On Windows, however, the tempfile code uses the _os.O_TEMPORARY flag at creation time to tell *Windows* to delete the file when it gets closed. In that case, writing to the delete attribute has no effect (since the flag has already been set) Perhaps the windows special casing should be removed so that the delete flag on named temporary files can be effectively written to on all platforms? Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia --------------------------------------------------------------- _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com