且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

python 2 [错误32]该进程无法访问文件,因为该文件正在被另一个进程使用

更新时间:2021-12-21 23:14:40

它在这里发生:

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)

在此语句内,您必须在with语句外

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