Subject: Keep temporary files
Date: Wed 02 Jan 13 07:14:18AM +0900
Quoting J??r??me R. ([email protected]):
In a project I am working on, Tempfile objects are used. Fine, but I
would like to add an option “keep temp file”, in order to facilitate
debug in case of error.
It seems that Tempfile object doesn’t provide any way to do that. Would
you think it could a possible enhancement?
I think it may be an enhancement for your program, not for Tempfile:
the reson for existence of that class is to make sure the files it
handle will be deleted as soon as they get closed.
If you want to keep your files, designate a directory for them (I
generally create a directory under /usr/share) and give to them names
that include the time and date (to make sure there are no risk of
duplicate names). Something like:
You then may want to write a cleanup script that makes sure files
older than a few weeks/months are deleted.