Daniel Lenski <dlen...@gmail.com> added the comment: Tim Golden, My preferred solution would be to replace the binary delete argument of the current NamedTemporaryFile implementation with finer-grained options: delete=False # don't delete delete=True # delete after file closed, current behavior delete=AFTER_CLOSE # delete after file closed delete=AFTER_CM_EXIT # delete after context manager exits delete=AFTER_CM_EXIT_NO_EXCEPTION # delete after CM exit, unless this is due to an exception
I have implemented a Windows-friendly solution to the latter case using Nick Coghlan's code. My version does not delete the file until the context manager exits, and *if* the context manager exits due to an exception it leaves the file in place and reports its location, to aid me in debugging. ---------- Added file: http://bugs.python.org/file26215/ntempfile.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14243> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com