fsiler / pdfsizeopt

Automatically exported from code.google.com/p/pdfsizeopt
0 stars 0 forks source link

Better temporary file handling by default #67

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. Create temporary files in /tmp (etc.), not in the current directory.

2. Remove temporary files by default upon success and failure.

Original issue reported on code.google.com by pts...@gmail.com on 6 Aug 2012 at 9:29

GoogleCodeExporter commented 9 years ago
There's perhaps one pythonic way (supported by all versions of Python since 
2.3, AFAIK) to create such files:

* use tempfile.mkstemp (the created file needs manual removal).
* use tempfile.NamedTemporaryFile (is automatically removed when the file is 
closed).

Reference: http://docs.python.org/2/library/tempfile.html

Original comment by rbr...@gmail.com on 27 Feb 2013 at 11:29

GoogleCodeExporter commented 9 years ago
Thank you for filing this feature request.

I want to give the user more control over temporary files: i.e. remove them on 
success? remove them on failure? I think tempfile.mkstemp doesn't give these 
controls.

Blindly using tempfile.mkstemp would take away those controls and it would make 
debugging much harder. So not doing that quickly right now.

Original comment by pts...@gmail.com on 27 Feb 2013 at 1:44