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


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

Re: os.access giving incorrect results on Windows

Started by"Ayaskanta Swain" <ayaskanta.swain@altair.com>
First post2011-05-20 16:56 +0530
Last post2011-05-20 16:56 +0530
Articles 1 — 1 participant

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


Contents

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

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

From"Ayaskanta Swain" <ayaskanta.swain@altair.com>
Date2011-05-20 16:56 +0530
SubjectRe: os.access giving incorrect results on Windows
Message-ID<mailman.1837.1305890612.9059.python-list@python.org>

[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

 

[toc] | [standalone]


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


csiph-web