PermissionError: [WinError 5] Access is denied
<p>Everytime I try to delete a file using <code>os.remove()</code> in Python 3.5.1, I get this message <code>PermissionError: [WinError 5] Access is denied</code></p>

<p>And here is that simple code:</p>

<pre><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)
</code></pre>

<p>Didn't even delete a single file in the directory or sub-directory.</p>