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


Groups > comp.lang.python > #107872

Re: Why does pathlib not have is_readable() & things like that?

From Grant Edwards <grant.b.edwards@gmail.com>
Newsgroups comp.lang.python
Subject Re: Why does pathlib not have is_readable() & things like that?
Date 2016-04-29 23:53 +0000
Message-ID <mailman.236.1461973992.32212.python-list@python.org> (permalink)
References (5 earlier) <mailman.188.1461850479.32212.python-list@python.org> <manbvcxjkl.ln2@news.ducksburg.com> <lf5r3dor5ue.fsf@ling.helsinki.fi> <CACL+1avGZzy8e54RCHTqk4SNULTAcZMuQH_+L3m1OXx=Chs+4Q@mail.gmail.com> <ng0s4v$c73$1@ger.gmane.org>

Show all headers | View raw


On 2016-04-29, eryk sun <eryksun@gmail.com> wrote:
> On Fri, Apr 29, 2016 at 6:51 AM, Jussi Piitulainen
><jussi.piitulainen@helsinki.fi> wrote:
>> Adam Funk writes:
>>> On 2016-04-28, Grant Edwards wrote:
>>
>>>> Or just do os.access("directory/where/you/want/to/open/a/file",os.W_OK)
>>>
>>> That's what I'm doing now, but I prefer to give the user the error
>>> message early on.
>>
>> Then do that early on.
>
> Note that on Windows os.access only checks if a file is read-only.
> There's a proposed update to check the file security. The patch needs
> to be updated and needs to be reworked, but it's a low priority. For
> the most part calling os.access isn't recommended.

I'm sure there are probably other ways that it fails also.  That's why
it's almost always simpler and better to just open the file in write
mode and see if it works.

--
Grant

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


Thread

Why does pathlib not have is_readable() & things like that? Adam Funk <a24061@ducksburg.com> - 2016-04-26 14:30 +0100
  Re: Why does pathlib not have is_readable() & things like that? Random832 <random832@fastmail.com> - 2016-04-26 09:57 -0400
    Re: Why does pathlib not have is_readable() & things like that? Adam Funk <a24061@ducksburg.com> - 2016-04-28 14:02 +0100
      Re: Why does pathlib not have is_readable() & things like that? Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-28 16:24 +0300
      Re: Why does pathlib not have is_readable() & things like that? Grant Edwards <grant.b.edwards@gmail.com> - 2016-04-28 13:34 +0000
        Re: Why does pathlib not have is_readable() & things like that? Adam Funk <a24061@ducksburg.com> - 2016-04-29 10:49 +0100
          Re: Why does pathlib not have is_readable() & things like that? Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-29 14:51 +0300
            Re: Why does pathlib not have is_readable() & things like that? eryk sun <eryksun@gmail.com> - 2016-04-29 10:09 -0500
            Re: Why does pathlib not have is_readable() & things like that? Grant Edwards <grant.b.edwards@gmail.com> - 2016-04-29 23:53 +0000
  Re: Why does pathlib not have is_readable() & things like that? Steven D'Aprano <steve@pearwood.info> - 2016-04-27 01:46 +1000
    Re: Why does pathlib not have is_readable() & things like that? Adam Funk <a24061@ducksburg.com> - 2016-04-28 13:57 +0100

csiph-web