Permission denied when opening a file that was created concurrently by os.rename (Windows)
Terry Reedy
tjreedy at udel.edu
Sun Apr 5 16:10:06 EDT 2015
On 4/5/2015 1:45 PM, Alexey Izbyshev wrote:
> Hello!
>
> I've hit a strange problem that I reduced to the following test case:
> * Run several python processes in parallel that spin in the following loop:
> while True:
> if os.path.isfile(fname):
> with open(fname, 'rb') as f:
> f.read()
> break
Besides anything else, I would consider adding a minimal sleep in the loop.
> * Then, run another process that creates a temporary file and then
> renames it to the name than other processes are expecting
> * Now, some of the reading processes occasionally fail with "Permission
> denied" OSError
--
Terry Jan Reedy
More information about the Python-list
mailing list