Python tempfile [Errno 66] Directory not empty
This question already has an answer here:
I'll just note that path = os.path.join(tmpdir)
makes path
equal to tmpdir
. That said, when a directory is not empty, neither os.remove
or os.rmdir
will work.
Those are operating system calls, which don't recurse to files contained in the directory.
So just use
import shutil
shutil.rmtree(tmpdir)
链接地址: http://www.djcxy.com/p/42416.html