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 -- http://mail.python.org/mailman/listinfo/python-list