Steven D'Aprano <[EMAIL PROTECTED]> wrote:

> On Wed, 19 Mar 2008 12:34:34 +0000, Duncan Booth wrote:
>> By default Python on Windows allows you to open a file for reading
>> unless you specify a sharing mode which prevents it: 
> 
> But the OP is talking about another process having opened the file for 
> WRITING, not reading. It's that other process that has exclusive access, 
> and the OP was trying to determine when it was safe to attempt opening 
> the file according to whether or not it was still growing.
> 
No, unless the other process has specified that it wants exclusive access 
there is nothing stopping his process also opening the file. That's why he 
has to specify when he opens it that he wants exclusive access: then it 
doesn't matter what the other process does, he won't be able to open it 
until the other process has closed the file.

This all of course assumes that the other process writes the file in one 
single atomic chunk. If it were to create it and then separately open and 
write to it then all bets are off.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to