i am trying to delete a directory but when i run the code it gives windows error 5: access is denied. here is my code: in the Release folder, there is a folder called
This was due to the file permissions issue.
You need to have the permissions to perform that task on that file.
To get the permissions associated with a file, useos.stat(fileName)
You can explicitly check the write permission for that file using os.access(fileName, os.W_OK)
Then, to change the permission, os.chmod(fileName,permissionNumeric)
.
Ex: os.chmod(fileName, '0777')
To change the permission for the current file that is being executed,
use os.chmod(__file__, '0777')