Rename of .mdb file -- lock

Scott David Daniels Scott.Daniels at Acm.Org
Mon Dec 15 20:01:02 CET 2008

noydb wrote:
> I have the code below, which unzips a zipfile containing only one
> file.  Once it is unzipped, I want to rename the file based on a user
> provided name.  But I get this (WindowsError: [Error 32] The process
> cannot access the file because it is being used by another process)
> error, which does not make sense to me as no other apps are open.
> Any suggestions?

Others have told you the reason you are currently having problems.
You should also be aware that Windows can at "random" times be opening
the new file in order to either index it or virus scan it, and it may
fail to rename during that period.  So, a failure should retry in a
second a couple of times before giving up.  This is my understanding,
but someone deeply familiar with Windows internals might reveal that
I am operating on older information.

--Scott David Daniels
Scott.Daniels at Acm.Org

More information about the Python-list mailing list