I'm building a file-transfer script, and the source cleanup function makes use of os.rmdir('C:\\Users\\Grav\\Desktop\\TestDir0\\Om')
. This is the error I get:
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\Grav\\Desktop\\TestDir0\\Om'
I checked the permissions on the folder Om
through the Windows 7 and they are set to allow deletion for my user account. I've also tried setting my interpreter to run as admin. The problem persists and I'm stymied. Much obliged to anyone with insight!
I found a solution here: What user do python scripts run as in windows?
It seems as if the offending folder has a stubborn read-only attribute. Adding in a handler to change such read-only flags worked like a charm for me.
All of you who posted suggestions, you helped me track down the final answer, so thank you!