Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107789
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| 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 | Thu, 28 Apr 2016 13:34:31 +0000 (UTC) |
| Lines | 26 |
| Message-ID | <mailman.188.1461850479.32212.python-list@python.org> (permalink) |
| References | <6474vcx0q6.ln2@news.ducksburg.com> <1461679044.2467938.590028273.4DEA02AA@webmail.messagingengine.com> <mailman.106.1461679046.32212.python-list@python.org> <r8e9vcxf2a.ln2@news.ducksburg.com> <nft3h7$pbt$1@ger.gmane.org> |
| X-Trace | news.uni-berlin.de +mCwWKlH4br36iVZJFB/6QU4KwhIEFzDMiPN7Mk7W5dA== |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'that?': 0.05; 'get.': 0.09; 'jesus': 0.09; 'processing,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:qwest.net': 0.09; 'skip:o 60': 0.09; 'subject:Why': 0.09; 'python': 0.10; 'subject:not': 0.11; 'output': 0.13; 'useful,': 0.13; 'adam': 0.16; 'data)': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'library,': 0.18; '>>>': 0.20; 'bit': 0.23; 'header:User-Agent:1': 0.26; "doesn't": 0.26; '(which': 0.26; 'header:X-Complaints-To:1': 0.26; 'rest': 0.26; 'specify': 0.27; 'command-line': 0.29; 'crash': 0.29; 'subject:that': 0.29; "i'm": 0.30; 'putting': 0.30; "i'd": 0.31; 'error.': 0.31; 'service,': 0.31; 'option': 0.31; 'getting': 0.33; 'directory,': 0.33; 'subject:like': 0.33; 'surprised': 0.33; 'open': 0.33; 'tue,': 0.34; 'file': 0.34; 'gives': 0.35; 'but': 0.36; 'there': 0.36; 'tool': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'things': 0.38; 'data': 0.39; 'takes': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'back': 0.62; 'here': 0.66; 'offer': 0.66; '26,': 0.72; 'subject:have': 0.80; 'discovered': 0.83; 'edwards': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | 67-130-15-94.dia.static.qwest.net |
| User-Agent | slrn/1.0.2 (Linux) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <nft3h7$pbt$1@ger.gmane.org> |
| X-Mailman-Original-References | <6474vcx0q6.ln2@news.ducksburg.com> <1461679044.2467938.590028273.4DEA02AA@webmail.messagingengine.com> <mailman.106.1461679046.32212.python-list@python.org> <r8e9vcxf2a.ln2@news.ducksburg.com> |
| Xref | csiph.com comp.lang.python:107789 |
Show key headers only | View raw
On 2016-04-28, Adam Funk <a24061@ducksburg.com> wrote:
> On 2016-04-26, Random832 wrote:
>
>> On Tue, Apr 26, 2016, at 09:30, Adam Funk wrote:
>>> I recently discovered pathlib in the Python 3 standard library, & find
>>> it very useful, but I'm a bit surprised that it doesn't offer things
>>> like is_readable() and is_writable. Is there a good reason for that?
>>
>> Well, one reason would be EAFP. Just try to open the file and see if it
>> gives you a PermissionError.
>
> I understand that in general, but the tool I'm working on here takes a
> command-line option to specify an output directory, & I'd rather not
> start processing the data (which involves GETting from a REST service,
> processing, and PUTting back modifications to the data) only to crash
> after the first batch because of a user error.
Then open the output file before you do the GET.
Or just do os.access("directory/where/you/want/to/open/a/file",os.W_OK)
--
Grant Edwards grant.b.edwards Yow! Jesus is my POSTMASTER
at GENERAL ...
gmail.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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