By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,446 Members | 1,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,446 IT Pros & Developers. It's quick & easy.

os.access() problem

P: n/a
I just got a new PC with Windows XP, and I want to run Leo on it. Leo
uses the os.access() function to check for read-only files. For some
reason, os.access(<filename>, os.W_OK) always returns false.

I wrote a 2-liner Python script to just test os.access on any file.
I have tried this with Python 2.4 and 2.5b1.
I have uninstalled and re-installed Python and Leo.
I have fiddled with file permissions on the target files as well as on
the Python installation itself.
I have used cacls to check the access control lists (and although I'm
not exactly certain what to do with this information, it appears to be
ok - I think).

None of the above has helped me to identify or fix the problem.

A scan of the Python newsgroup suggests that os.access() may not be the
best way to check for read-only, but the discussion is a bit deeper
than my understanding, so I'm not sure there's anything to it in this
case.

I realize this must be a Windows permissions thing, but I just can't
figure it out. I'm no expert in Windows security beyond basic
permissions, so I could be missing something simple. Can anyone offer
any suggestions?

Thanks,
Phil

Jul 11 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Phil Schmidt wrote:
I just got a new PC with Windows XP, and I want to run Leo on it. Leo
uses the os.access() function to check for read-only files. For some
reason, os.access(<filename>, os.W_OK) always returns false.

I wrote a 2-liner Python script to just test os.access on any file.
I have tried this with Python 2.4 and 2.5b1.
I have uninstalled and re-installed Python and Leo.
I have fiddled with file permissions on the target files as well as on
the Python installation itself.
I have used cacls to check the access control lists (and although I'm
not exactly certain what to do with this information, it appears to be
ok - I think).

None of the above has helped me to identify or fix the problem.

A scan of the Python newsgroup suggests that os.access() may not be the
best way to check for read-only, but the discussion is a bit deeper
than my understanding, so I'm not sure there's anything to it in this
case.

I realize this must be a Windows permissions thing, but I just can't
figure it out. I'm no expert in Windows security beyond basic
permissions, so I could be missing something simple. Can anyone offer
any suggestions?

Thanks,
Phil
I just tested on Windows XP with ActiveState Python 2.4.1 and it works
as expected.
>>import os
os.access(r'c:\output.txt', os.W_OK)
True

Changed file to read-only
>>os.access(r'c:\output.txt', os.W_OK)
False
>>>
FYI, Larry Bates
Jul 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.