renaming an open file in nt like unix?

aaron.watters at aaron.watters at
Wed Jul 25 14:16:45 CEST 2007

On Jul 13, 2:44 pm, Steve Holden <st... at> wrote:
> Thomas Heller wrote:
> > aaron.watt... at schrieb:=
> >> ...Do the NT file systems support [renaming an open file] (which I think is
> >> standard for POSIX systems)?
> > Yes, you can do that.  We implemented something like this to replace
> > dlls there are currently in use...
> You do have to be careful though, because sometimes Windows refuses to
> let you rename a file because it's in use.

At least on my laptop I see Steve's behaviour. fwiw:

C:\Documents and Settings\aaron\Desktop> rename
rename sleeps 1
renamer sleeping 5
now renaming
Traceback (most recent call last):
  File "C:\Documents and Settings\aaron\Desktop\", line 69,
in <modul
  File "C:\Documents and Settings\aaron\Desktop\", line 31,
in rename
    os.rename(firstname, secondname)
WindowsError: [Error 13] The process cannot access the file because it
is being
used by another process

So it looks like the answer in general is "no: you can't do that
on Windows."

Drat! Foiled again.
   -- Aaron Watters

Is a bear catholic?
Does the Pope ...?

More information about the Python-list mailing list