Skip to content Skip to sidebar Skip to footer

Python 2 [error 32] The Process Cannot Access The File Because It Is Being Used By Another Process

I'm working with python 2 and have read several posts about this error i.e(this post). However, I'm still getting the error. What I do is: I read the files in a directory, if any

Solution 1:

it happens here :

with open(os.path.join(root, documento), 'r') as fin:

So you have your file open and locked, that is why you are not able delete this folder using:

shutil.rmtree(root)

within this statement, you have to do outside of with statement

Post a Comment for "Python 2 [error 32] The Process Cannot Access The File Because It Is Being Used By Another Process"