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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ayaskanta.swain@altair.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'filename:fname piece:py': 0.04; 'permissions': 0.04; 'suggestions.': 0.07; 'python': 0.08; 'executed': 0.09; 'tim,': 0.09; 'def': 0.12; 'error:': 0.12; 'bangalore': 0.14; 'defined': 0.14; '[errno': 0.16; 'oserror:': 0.16; 'received:203.200': 0.16; 'tests)': 0.16; 'permission': 0.16; 'traceback': 0.16; '(most': 0.16; 'skip:= 70': 0.17; 'suggest': 0.19; 'script.': 0.19; 'subject:Windows': 0.20; 'wrote': 0.22; 'last):': 0.23; 'code': 0.24; 'function': 0.25; 'user.': 0.26; '&gt;': 0.26; '(in': 0.26; 'script': 0.27; 'tried': 0.27; 'thanks': 0.28; '(not': 0.28; 'skip:- 70': 0.29; 'class': 0.29; 'skip:( 20': 0.30; 'ran': 0.30; 'looks': 0.31; 'it.': 0.31; "skip:' 10": 0.32; 'patch': 0.32; 'to:addr:python-list': 0.33; 'error': 0.33; '...': 0.34; 'file': 0.34; 'using': 0.35; 'test': 0.35; 'charset:us-ascii': 0.36; 'open': 0.36; 'skip:& 20': 0.37; 'url:rec-html40': 0.37; 'issue': 0.37; 'checks': 0.37; 'case': 0.37; 'url:org': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'received:192': 0.38; 'to:addr:python.org': 0.39; 'under': 0.40; 'providing': 0.61; 'forward': 0.62; 'content- type:application/octet-stream': 0.63; 'straight': 0.63; 'reply': 0.63; 'denied:': 0.84; 'received:192.168.0.100': 0.84; 'tricky': 0.84
X-IronPort-AV E=Sophos;i="4.65,242,1304274600"; d="py'?scan'208,217";a="298497"
X-MimeOLE Produced By Microsoft Exchange V6.5
Content-class urn:content-classes:message
MIME-Version 1.0
Content-Type multipart/mixed; boundary="----_=_NextPart_001_01CC16E0.56C00585"
Subject Re: os.access giving incorrect results on Windows
Date Fri, 20 May 2011 16:56:19 +0530
X-MS-Has-Attach yes
X-MS-TNEF-Correlator
Thread-Topic Re: os.access giving incorrect results on Windows
Thread-Index AcwW4L2yHW4fJcD+Sw6G4LJM3DDjJQ==
From "Ayaskanta Swain" <ayaskanta.swain@altair.com>
To <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1837.1305890612.9059.python-list@python.org> (permalink)
Lines 327
NNTP-Posting-Host 82.94.164.166
X-Trace 1305890612 news.xs4all.nl 49179 [::ffff:82.94.164.166]:36187
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5849

Show key headers only | 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