permission denied when using rmtree
Posted on 2009-02-10
I am using python 2.3 on windows.
Whenever I run shutil.rmtree(mypath), I get the following error
File "c:\Python23\lib\shutil.py", line 142, in rmtree^M
826 raise exc, (exc, exc + ' removing '+arg)^M
827 OSError: [Errno 13] Permission denied removing c:/temp/mydir
I am not sure why it is doing this. I have all permissions open on the temp drive.
No other program (to my knowledge) is using the same path that I am trying to delete.
"c:\Python23\lib\shutil.py" is pasted below:
def rmtree(path, ignore_errors=False, onerror=None):
"""Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if
onerror is set, it is called to handle the error; otherwise, an
exception is raised.
cmdtuples = 
arg = path
func = os.listdir # Make sure it isn't unset
for func, arg in cmdtuples:
exc = sys.exc_info()
elif onerror is not None:
onerror(func, arg, exc)
raise exc, (exc, exc + ' removing '+arg)