2010-11-23 21 views
1

我使用Python 2.5。並有一個問題,shutil.moveshutil.move - > WindowsError:[Error32]進程無法訪問文件

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

輸出:

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' 

我用它的Windows 2003 Server上。

那麼,這裏有什麼問題?有人知道嗎?

最好的問候。

回答

5

如果你想繼續在腳本中使用:

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

的原因,您收到錯誤32是因爲有您的計算機或正在使用該文件服務器上的另一個進程。您可能不想複製臨時文件,因爲它們名稱並不重要。

相關問題