os.access giving incorrect results on Windows
Ayaskanta Swain
ayaskanta.swain at altair.com
Fri May 20 07:26:19 EDT 2011
Hi Tim,
Thanks for the reply and suggestions. I followed the patch provided by
you in issue 2528, but the code looks very tricky to me. Anyways I wrote
my Test.py script & tried only the def test_access_w(self): test case
which is defined under class FileTests(unittest.TestCase) by providing
my own directory path to check the write permissions on it.
I executed my But it failed with the following errors -
> python Test.py C:\temp\my_dir
test_access_w (__main__.FileTests) ... ERROR
======================================================================
ERROR: test_access_w (__main__.FileTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "Test.py", line 14, in test_access_w
f = os.open(dirpath, os.O_CREAT)
OSError: [Errno 13] Permission denied: 'C:\\temp\\my_dir'
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (errors=1)
Basically the os.open() function is failing to open a directory (In this
case my_dir). The directory has write permissions for the user. Attached
herewith is my Test script. Can you please suggest some simple python
code which checks the write permissions of a directory in a straight
forward way (Not by using unit tests)
Thanks
Ayaskant-
Bangalore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110520/9a687587/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.py
Type: application/octet-stream
Size: 1577 bytes
Desc: Test.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20110520/9a687587/attachment-0001.obj>
More information about the Python-list
mailing list