<pre>Hi Tim,<br><br>Thanks for your reply. It seems this issue is related to python bug - <a href="http://bugs.python.org/issue2528">http://bugs.python.org/issue2528</a></pre><pre></pre><pre>But the patch code looks complex to me. I want to make changes only in my python script which will read an user given directory path & check it's write access. What is the use of posixmodule.c file? </pre>
<pre></pre><pre>I also went through the link that you provided - <a href="http://timgolden.me.uk/python/win32_how_do_i/add-security-to-a-file.html">http://timgolden.me.uk/python/win32_how_do_i/add-security-to-a-file.html</a></pre>
<pre>The code section in this link has a line  - </pre><pre>    sd = win32security.GetFileSecurity (FILENAME, win32security.DACL_SECURITY_INFORMATION)</pre><pre></pre><pre>Can we retrieve any write access information from this sd object in the python script?</pre>
<pre> </pre><pre>Thanks</pre><pre>Ayaskant-</pre><pre>-------------------------------------------------------------------------------------------------------</pre><pre> </pre><pre>On 12/08/2011 11:41, Ayaskanta Swain wrote:</pre>
<pre>><i> Hi,</i></pre><pre>><i> </i></pre><pre>><i> I have a requirement where I need to check the write permissions on a</i></pre><pre>><i> directory on Windows platform. I don’t want to use the python function</i></pre>
<pre>><i> os.access( ), since it does not work correctly on Windows. It is giving</i></pre><pre>><i> incorrect results to me.</i></pre><pre>><i> </i></pre><pre>><i> Another option of actually creating a temporary file inside the folder &</i></pre>
<pre>><i> then deleting it to check whether the user has write permissions or not</i></pre><pre>><i> is causing performance issues. It is slowing down our application when</i></pre><pre>><i> we have to check the permissions on hundreds of folders. It also changes</i></pre>
<pre>><i> the last access time stamp of the folder.</i></pre><pre>><i> </i></pre><pre>><i> So is there any other way such as using Win32API or Win32 security</i></pre><pre>><i> modules to check the permissions?</i></pre>
<pre> </pre><pre>In general, yes. Depends how finicky you want to get. I take it from</pre><pre>your question that you're pretty much unfamiliar with the Windows</pre><pre>Security APIs and structures? There's a quite a bit of information</pre>
<pre>around on the subject, but have a look at this first which is at</pre><pre>least Python-oriented:</pre><pre> </pre><pre><a href="http://timgolden.me.uk/python/win32_how_do_i/add-security-to-a-file.html">http://timgolden.me.uk/python/win32_how_do_i/add-security-to-a-file.html</a></pre>
<pre> </pre><pre>The trouble is that do what you want, you need to use the AccessCheck</pre><pre>API (or emulate its functionality) and this isn't currently exposed by</pre><pre>the pywin32 modules. You could run it up yourself with ctypes or by</pre>
<pre>creating a quick extension for the purpose. Alternatively, as I say,</pre><pre>you could emulate by scanning the ACLs/ACEs and trying to apply some</pre><pre>suitable logic. Frankly, I'd have thought this was harder work :)</pre>
<pre> </pre><pre>Hope that helps</pre><pre> </pre><pre>TJG</pre>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: Arial;"> </span></p>