开发者

shutil.move -> WindowsError: [Error32] The process cannot access the file

I use Python 2.5. and have a problem with shutil.move

print(srcFile)
print(dstFile)
shutil.move(srcFile, dstFile)

Output:

c:\docume~1\aaa\locals~1\temp\3\tmpnw-sgp
D:\dirtest\d\c\test.txt
...
WindowsError: [Error32] The process cannot access the file because it is being used by 
  another process: 'c:\\docume~1\\aaa\\locals~1\\temp\\3\\tmpnw-sgp'

I use it on a Windows 2003 Server.

So, what's wrong开发者_如何学Python here? Does anyone know?

Best Regards.


If you want to continue in your script use:

try:
    shutil.move(srcFile, dstFile)
except WindowsError:
    pass

The reason your getting error 32 is because there is another process on your computer or server that is using that file. You might want to not copy temp files as they are not really important by name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜