Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5783 > unrolled thread

Re: os.access giving incorrect results on Windows

Started byTim Golden <mail@timgolden.me.uk>
First post2011-05-19 20:43 +0100
Last post2011-05-19 20:43 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: os.access giving incorrect results on Windows Tim Golden <mail@timgolden.me.uk> - 2011-05-19 20:43 +0100

#5783 — Re: os.access giving incorrect results on Windows

FromTim Golden <mail@timgolden.me.uk>
Date2011-05-19 20:43 +0100
SubjectRe: os.access giving incorrect results on Windows
Message-ID<mailman.1798.1305834251.9059.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web