Unlinking Files on Windows

/!\ This page is intended for developers.

This page describes what happens when Python's 'os.unlink(f)' is called on Windows.

1. File opened using Python's "open"

If the file f has been opened for reading by another process using Python's 'open(f)', then 'os.unlink(f)' will raise

WindowsError: [Error 32] The process cannot access the file because it is being
used by another process: <f>

2. File opened using Mercurial's "posixfile"

If the file f has been opened for reading by another process with 'posixfile(f)', calling unlink will send that file into a "scheduled delete" state.

Scheduled delete has the following characteristics:

Scheduled delete is left as soon as the other process closes the file.

3. See also


CategoryInternals