os.access giving incorrect results on Windows

Ayaskanta Swain ayaskanta.swain at altair.com
Thu May 19 15:37:22 EDT 2011


Hi All,

 

Please help me in solving this issue. I want to check the write
permissions on a directory on windows from my python script.

 

I tried to use os.access(dirpath, os.W_OK)  to check whether the user
has write access or not, but it gives me incorrect result. It always
gives me False even if the user has write permission. Interestingly this
function works just fine on Linux platforms.

 

There is another way to check the write permissions by creating a
temporary file inside the directory & then removing it. Catch the
exception if create file is not allowed to decide the iswritable value.
But this is changing the last modification time (timestamp) of the
directory which is a critical issue for our application.

 

Please suggest a solution.

 

Thanks

Ayaskant-

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110520/8610874a/attachment.html>


More information about the Python-list mailing list