I have a script which is suppose to recurively remove corrupt code I am working with.
import shutil
import subprocess
path = subprocess.check_output("echo %APPDATA%", shell=True)
path = "%s\\" % path[:-2]
shutil.rmtree("%sPub\\Cache\\" % path)
and it fails at the rmtree call. It looks like it fails in the rmtree call at:
os.remove(fullname)
and then it will throw the error saying:
WindowsError: [Error 5] Access is denied: '.............'
I have tried both running this in a regular shell and an admin shell and im not sure what is going on. Maybe the subprocess launched by os.remove is not admin? I figured those rights would be passed into the child processes forked by my python script.
Thoughts?