Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

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 here? Does anyone know?

Best Regards.

like image 245
Tim Avatar asked Dec 02 '25 20:12

Tim


1 Answers

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.

like image 104
Jakob Bowyer Avatar answered Dec 04 '25 09:12

Jakob Bowyer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!