On 02/23/2015 01:02 PM, Brett Cannon wrote:
On Mon Feb 23 2015 at 3:51:18 PM Paul Moore wrote:
The real problem with overwriting is if there's a failure during the overwrite you lose the original file. My original API had overwrite as the default, but I think the risk makes that a bad idea.
Couldn't you catch the exception, write the original file back out, and then re-raise the exception?
This seems to be getting pretty complex for a nice-to-have.
One option would be to allow outputs (TARGET in pack() and NEW_ARCHIVE in set_interpreter()) to be open files (open for write in bytes mode) as well as filenames[1].
+1 for this.
BTW, while I was looking at the API, I realised I don't like the order of arguments in pack(). I'm tempted to make it pack(directory, target=None, interpreter=None, main=None) where a target of None means "use the name of the source directory with .pyz tacked on", exactly as for the command line API.
What do you think? The change would be no more than a few minutes' work if it's acceptable.
+1 from me.
+1 from me as well. -- ~Ethan~