I have been running into similar issues / the same error message on Windows 10 with calls to shutil.rmtree(dir) being denied access and subsequently not being executed. This in a primitive backup program I wrote which is designed to delete backups over a certain age. I am still testing the below but thus far it works as a temporary workaround in my setups however your mileage may vary.
Running the script as administrator didn't help either. Using os.chmod(f, S_IWRITE) [and/or stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR | stat.S_IWGRP | stat.S_IXGRP] also got the same refusal by the OS. Changing Controlled Folder Access (which I suspect may be causing this some of the time in Windows 10) and also modifying read only properties on the respective directories also did not help. Neither did changing ownership nor write access in the security tab help.
The workaround I use at the moment is to install, import and use the 'send2trash' module which can be used to remove the directory - assuming your program is otherwise sound - without said access error.
Thereafter one can delete the file from the recycle bin by hand or by automated means(after import of shell from win32com.shell) - obviously this second step will remove all files from the recycle bin. So absolutely check and think BEFORE you run this otherwise you may lose data you don't want to....).
I hope this is helpful.