os.removedirs(tardet_dir) File "D:\program\python37\lib\os.py", line 239, in removedirs rmdir(name)
时间: 2023-10-02 16:05:50 浏览: 195
This error occurs when the os.removedirs() function is unable to remove a directory because it is not empty. The function attempts to remove all the directories in the path, recursively, until it reaches the target directory. If any of the directories in the path are not empty, the function will raise an error.
To fix this error, you can manually delete the contents of the directory before calling os.removedirs(). Alternatively, you can use the shutil.rmtree() function, which will remove the entire directory tree, including all files and subdirectories, without raising an error.
阅读全文