我使用Python 2.5.和shutil.move有问题
print(srcFile)
print(dstFile)
shutil.move(srcFile, dstFile)
Run Code Online (Sandbox Code Playgroud)
输出:
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'
Run Code Online (Sandbox Code Playgroud)
我在Windows 2003 Server上使用它.
那么,这里有什么问题?有人知道吗?
最好的祝福.
如果要继续使用脚本:
try:
shutil.move(srcFile, dstFile)
except WindowsError:
pass
Run Code Online (Sandbox Code Playgroud)
您收到错误32的原因是您的计算机或服务器上有另一个正在使用该文件的进程.您可能不希望复制临时文件,因为它们名称并不重要.