title: How to authorize/deny write access to a directory on Windows using Python?
body: <p>I would like to be able to authorize or deny write access to a specific directory on Windows XP and more.</p>
  
  <p>I tried the following, and they all don't work:</p>
  
  <ul>
  <li><code>os.chmod()</code>: only a file read-only attribute can be specified, see <a href="https://docs.python.org/2/library/os.html#os.chmod" rel="nofollow">Python's doc</a></li>
  <li><code>win32api.SetFileAttribute()</code> <em>FILE_ATTRIBUTE_READONLY: A file that is read-only. [...] This attribute is not honored on directories</em>, see <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365535%28v=vs.85%29.aspx" rel="nofollow">MSDN's SetFileAttribute</a></li>
  </ul>
  
  <p>It looks like the only alternative I have is to access and update the "<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa379579.aspx" rel="nofollow">Security info</a>" of the directory, I've tried for several hours to get something done with this without much success (I'm really unfamiliar with Win32 API).</p>
  
  <p>Any ideas on how to do that?</p>