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


Groups > comp.lang.python > #5849

Re: os.access giving incorrect results on Windows

Subject Re: os.access giving incorrect results on Windows
Date 2011-05-20 16:56 +0530
From "Ayaskanta Swain" <ayaskanta.swain@altair.com>
Newsgroups comp.lang.python
Message-ID <mailman.1837.1305890612.9059.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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

 

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: os.access giving incorrect results on Windows "Ayaskanta Swain" <ayaskanta.swain@altair.com> - 2011-05-20 16:56 +0530

csiph-web