Everytime I try to delete a file using os.remove()
in Python 3.5.1, I get this message PermissionError: [WinError 5] Access is denied
And here is that simple code:
def clean_thrash(path):
dirlist=get_dirlist(path)
for f in dirlist:
fullname=os.path.join(path,f)
if fullname == os.path.join(path,"thrash.txt"):
os.remove(path)
if os.path.isdir(fullname):
clean_thrash(fullname)
Didn't even delete a single file in the directory or sub-directory.