[Python-Dev] windows file closing race condition? (original) (raw)

Paul Moore p.f.moore at gmail.com
Fri Sep 6 14:55:17 CEST 2013


On 6 September 2013 13:21, Tim Golden <mail at timgolden.me.uk> wrote:

True, but then you're into determining a temporary name somewhere on the same volume if possible and avoiding collisions etc. Again, I don't think this is something we need to be doing by default in core Python.

Agreed.

There simply is no solution that works in all cases. If you rename the file to anywhere but the same directory, you potentially have permission issues. And if you rename to the same directory, you still can't delete the directory. It's a shame, because a helper to do this would be useful for Unix users wanting to ensure that their code works properly on Windows, but there really isn't an answer other than knowing how things work (and crafting an appropriate solution for your application), here...

Paul



More information about the Python-Dev mailing list