On 19/05/2011 20:37, Ayaskanta Swain wrote:
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.
This is basically issue2528 [1].
The problem is that, although Windows (and Python)
expose a version of os.access to match the Posix function,
the meaning is so far removed on Windows as to be useless.
Really what you need to do is use the AccessCheck API, which
is a little bit tortuous, but is intended for this purpose.
You can look at the code in my patch for that issue to get
an idea of how to do it.
Does that help?
TJG
[1] http://bugs.python.org/issue2528
--
http://mail.python.org/mailman/listinfo/python-list