On Jun 6, 12:30 pm, "Roger Upole" <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Can os.path.isfile(x) ever return True after os.remove(x) has
> > successfully completed? (Windows 2003,  Python 2.3)
>
> Yes.  If another application has opened the file with FILE_SHARE_DELETE,
> os.remove succeeds but the file doesn't actually disappear until the last open
> handle to it is closed.
>

Roger,

Thanks - you've hit the nail on the head. This is the final piece of
the puzzle and I've now been able to reproduce the problem!

The cause is ...

- a TSVCache.exe (Tortoise SVN) process is scanning the file with
FILE_SHARE_DELETE access at the moment that the os.remove occurs
- this causes os.remove to return but the file is still there while
the scan completes
- next, os.path.isfile returns True and the app raises an exception
- a short while later the scan is complete and Windows deletes the
file

Thanks to everyone who responded - I didn't expect to be able to get
to the bottom of this so quickly!

Thanks,

Paul

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to