Re: pathlib

2019-10-04 Thread Barry Scott
> On 2 Oct 2019, at 23:58, DL Neil via Python-list > wrote: > > In my mind, I'm wondering if it will come to that (having 'got past' the > original observation/issue, I'm concerned by .rename()'s silent errors, for > example). However, that 'outside' research, eg StackOverflow, shows that

Re: pathlib

2019-10-04 Thread Barry Scott
> On 3 Oct 2019, at 13:04, Richard Damon wrote: > > I am not sure that Concrete is really the right term here, but the > beginning of the documentation for Pathlib does sort of define what it > means here: There is a need to describe three ideas. The PurePath The OS Specific PurePath's, Wind

Re: pathlib

2019-10-03 Thread Richard Damon
On 10/2/19 6:27 PM, DL Neil via Python-list wrote: > On 3/10/19 3:07 AM, Rhodri James wrote: >> On 02/10/2019 09:14, DL Neil via Python-list wrote: >>> That said, it is one of the ways that a path can be shown to >>> transition from some 'pure' state to become 'concrete'. >>> >>> However, A.N.Other

Re: pathlib

2019-10-03 Thread Dan Sommers
On 10/2/19 6:58 PM, DL Neil via Python-list wrote: > On 3/10/19 12:42 AM, Dan Sommers wrote: > Certainly, although some may have quietly given-up talking to a > non-OOP native - and one so 'slow', I am appreciative of all > help-given! I also speak OO as a second language (usually kicking, screa

Re: pathlib

2019-10-02 Thread DL Neil via Python-list
On 3/10/19 12:42 AM, Dan Sommers wrote: On 10/2/19 4:14 AM, DL Neil via Python-list wrote: In the case that sparked this enquiry, and in most others, there is no need for a path that doesn't actually lead somewhere. The paths that are used, identify files, open them, rename them, create directo

Re: pathlib

2019-10-02 Thread DL Neil via Python-list
On 3/10/19 3:07 AM, Rhodri James wrote: On 02/10/2019 09:14, DL Neil via Python-list wrote: That said, it is one of the ways that a path can be shown to transition from some 'pure' state to become 'concrete'. However, A.N.Other has suggested that I might be mis-applying the word "concrete", s

Re: pathlib

2019-10-02 Thread DL Neil via Python-list
On 3/10/19 6:25 AM, Barry Scott wrote: On 2 Oct 2019, at 09:14, DL Neil via Python-list mailto:python-list@python.org>> wrote: On 2/10/19 12:52 AM, Rhodri James wrote: On 01/10/2019 06:03, DL Neil via Python-list wrote: On 30/09/19 9:28 PM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil

Re: pathlib

2019-10-02 Thread Barry Scott
> On 2 Oct 2019, at 09:14, DL Neil via Python-list > wrote: > > On 2/10/19 12:52 AM, Rhodri James wrote: >> On 01/10/2019 06:03, DL Neil via Python-list wrote: >>> On 30/09/19 9:28 PM, Barry Scott wrote: > On 30 Sep 2019, at 05:40, DL Neil via Python-list > wrote: > > Shoul

Re: pathlib

2019-10-02 Thread Rhodri James
On 02/10/2019 09:14, DL Neil via Python-list wrote: That said, it is one of the ways that a path can be shown to transition from some 'pure' state to become 'concrete'. However, A.N.Other has suggested that I might be mis-applying the word "concrete", so maybe not. On which topic, I went looki

Re: pathlib

2019-10-02 Thread Dan Sommers
On 10/2/19 4:14 AM, DL Neil via Python-list wrote: In the case that sparked this enquiry, and in most others, there is no need for a path that doesn't actually lead somewhere. The paths that are used, identify files, open them, rename them, create directories, etc. The idea of a path that just '

Re: pathlib

2019-10-02 Thread DL Neil via Python-list
On 2/10/19 12:52 AM, Rhodri James wrote: On 01/10/2019 06:03, DL Neil via Python-list wrote: On 30/09/19 9:28 PM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to the file-system? I think it should not. The term "co

Re: pathlib

2019-10-01 Thread Rhodri James
On 01/10/2019 06:03, DL Neil via Python-list wrote: On 30/09/19 9:28 PM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to the file-system? I think it should not. The term "concrete" is applied to Path(), PosixPath(),

Re: pathlib

2019-10-01 Thread Richard Damon
On 10/1/19 1:24 AM, DL Neil via Python-list wrote: > On 1/10/19 1:09 AM, Chris Angelico wrote: >> On Mon, Sep 30, 2019 at 9:54 PM Dan Sommers >> <2qdxy4rzwzuui...@potatochowder.com> wrote: >>> I would have said the same thing, but the docs⁰ disagree:  a >>> PurePath represents the name of (or the p

Re: pathlib

2019-10-01 Thread DL Neil via Python-list
On 1/10/19 2:58 PM, Dan Sommers wrote: On 9/30/19 3:56 PM, Barry Scott wrote: On 30 Sep 2019, at 16:49, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com > wrote: In the totality of a Path object that claims to represent paths to files, It represent

Re: pathlib

2019-10-01 Thread Chris Angelico
On Tue, Oct 1, 2019 at 3:05 PM DL Neil via Python-list wrote: > BUT... Path() does keep track of changes in the file system for other > attributes! So, why not also name? Does it actually track changes? > Here's a code-snippet illustrating both of the above points: > > import pathlib > p = pathl

Re: pathlib

2019-10-01 Thread Chris Angelico
On Tue, Oct 1, 2019 at 3:26 PM DL Neil via Python-list wrote: > > On 1/10/19 1:09 AM, Chris Angelico wrote: > > I don't think it represents the actual file. If it did, equality would > > be defined by samefile, NOT by the file name. > > > from pathlib import Path > import os > open(

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 3:21 AM, Dan Sommers wrote: On 9/30/19 8:40 AM, Barry Scott wrote:  >> On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote:  >> On 9/30/19 4:28 AM, Barry Scott wrote:   On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote:   Should pathlib r

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 1:40 AM, Barry Scott wrote: On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: On 9/30/19 4:28 AM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to the file-system? I think

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 1:09 AM, Chris Angelico wrote: On Mon, Sep 30, 2019 at 9:54 PM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: I would have said the same thing, but the docs⁰ disagree: a PurePath represents the name of (or the path to) a file, but a Path represents the actual file. ⁰ https

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 30/09/19 9:28 PM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to the file-system? I think it should not. The term "concrete" is applied to Path(), PosixPath(), and WindowsPath() - whereas the others are differen

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 3:56 PM, Barry Scott wrote: On 30 Sep 2019, at 16:49, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com > wrote: In the totality of a Path object that claims to represent paths to files, It represents string that *should* in most cases

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 16:49, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> > wrote: > > That's an interesting question. If you phrase the question like > that, then you're right: expecting a string to track the content > of a file is a mistake. > > In the totality of a Path object that

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 6:13 AM, Dan Sommers wrote: On 9/30/19 12:51 PM, Chris Angelico wrote: On Tue, Oct 1, 2019 at 1:51 AM Dan Sommers ... All I'm doing is defending the OP, who was surprised that renaming a file *using a Path instance* didn't reflect that operation *in that Path instance*.  I believe

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 12:51 PM, Chris Angelico wrote: On Tue, Oct 1, 2019 at 1:51 AM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: In the totality of a Path object that claims to represent paths to files, including the arguably troublesome read_bytes and write_bytes methods, and a rename method,

Re: pathlib

2019-09-30 Thread Chris Angelico
On Tue, Oct 1, 2019 at 1:51 AM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: > In the totality of a Path object that claims to represent paths > to files, including the arguably troublesome read_bytes and > write_bytes methods, and a rename method, however, it's not > unreasonable expect

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 10:33 AM, Barry Scott wrote: On 30 Sep 2019, at 14:20, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com > wrote: That's the wording I read.  I inferred that "path-handling operations which don't actually access a filesystem" meant an obje

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 14:20, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> > wrote: > > That's the wording I read. I inferred that "path-handling operations > which don't actually access a filesystem" meant an object that didn't > necessarily represent an actual file, and that "provide meth

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 8:40 AM, Barry Scott wrote: > > >> On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: >> >> On 9/30/19 4:28 AM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to th

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> > wrote: > > On 9/30/19 4:28 AM, Barry Scott wrote: >>> On 30 Sep 2019, at 05:40, DL Neil via Python-list >>> wrote: >>> Should pathlib reflect changes it has made to the file-system? >> I think it should not. >> A P

Re: pathlib

2019-09-30 Thread Chris Angelico
On Mon, Sep 30, 2019 at 9:54 PM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: > I would have said the same thing, but the docs⁰ disagree: a > PurePath represents the name of (or the path to) a file, but a > Path represents the actual file. > > > ⁰ https://docs.python.org/3/library/pathli

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 4:28 AM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to the file-system? I think it should not. A Path() is the name of a file it is not the file itself. Why should it track changes in the file system f

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 09:55, Peter Otten <__pete...@web.de> wrote: > > DL Neil via Python-list wrote: > >> Should pathlib reflect changes it has made to the file-system? >> >> >> Sample code, below, shows pathlib identifying a data-file and then >> renaming it. Yet, after the rename operation

Re: pathlib

2019-09-30 Thread Peter Otten
DL Neil via Python-list wrote: > Should pathlib reflect changes it has made to the file-system? > > > Sample code, below, shows pathlib identifying a data-file and then > renaming it. Yet, after the rename operation, pathlib doesn't recognise > its own change; whereas the file system does/proves

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 05:40, DL Neil via Python-list > wrote: > > Should pathlib reflect changes it has made to the file-system? I think it should not. A Path() is the name of a file it is not the file itself. Why should it track changes in the file system for the name? Here is code to show

Re: pathlib PurePosixPath

2017-10-10 Thread eryk sun
On Tue, Oct 10, 2017 at 11:18 AM, Tim Golden wrote: > On 2017-10-10 10:58, Chris Angelico wrote: >> On Tue, Oct 10, 2017 at 8:56 PM, Tim Golden wrote: >> >>> In fact its presence in that filename creates a (usually hidden) data >>> stream piggybacked onto that file which has the name "abc" into w

Re: pathlib PurePosixPath

2017-10-10 Thread Tim Golden
On 2017-10-10 10:58, Chris Angelico wrote: On Tue, Oct 10, 2017 at 8:56 PM, Tim Golden wrote: My understanding of the document you linked to is that the colon still has special meaning, and thus you can't use it in arbitrary file names. In fact its presence in that filename creates a (usua

Re: pathlib PurePosixPath

2017-10-10 Thread Chris Angelico
On Tue, Oct 10, 2017 at 8:56 PM, Tim Golden wrote: >> My understanding of the document you linked to >> is that the colon still has special meaning, and thus you can't use it >> in arbitrary file names. > > > In fact its presence in that filename creates a (usually hidden) data stream > piggybacke

Re: pathlib PurePosixPath

2017-10-10 Thread Tim Golden
On 2017-10-10 10:28, Chris Angelico wrote: On Tue, Oct 10, 2017 at 8:22 PM, Tim Golden wrote: On 2017-10-10 08:29, Chris Angelico wrote: On Tue, Oct 10, 2017 at 6:21 PM, Sayth Renshaw wrote: Hi How do I create a valid file name and directory with pathlib? When I create it using PurePos

Re: pathlib PurePosixPath

2017-10-10 Thread Chris Angelico
On Tue, Oct 10, 2017 at 8:22 PM, Tim Golden wrote: > On 2017-10-10 08:29, Chris Angelico wrote: >> >> On Tue, Oct 10, 2017 at 6:21 PM, Sayth Renshaw >> wrote: >>> >>> Hi >>> >>> How do I create a valid file name and directory with pathlib? >>> >>> When I create it using PurePosixPath I end up wit

Re: pathlib PurePosixPath

2017-10-10 Thread Tim Golden
On 2017-10-10 08:29, Chris Angelico wrote: On Tue, Oct 10, 2017 at 6:21 PM, Sayth Renshaw wrote: Hi How do I create a valid file name and directory with pathlib? When I create it using PurePosixPath I end up with an OSError due to an obvously invlaid path being created. You're on Windows.

Re: pathlib PurePosixPath

2017-10-10 Thread Thomas Jollans
On 2017-10-10 09:44, Sayth Renshaw wrote: > >>> Hi >>> >>> How do I create a valid file name and directory with pathlib? >>> >>> When I create it using PurePosixPath I end up with an OSError due to an >>> obvously invlaid path being created. >> >> You're on Windows. The rules for POSIX paths don'

Re: pathlib PurePosixPath

2017-10-10 Thread Peter Otten
Sayth Renshaw wrote: > Thanks. Updated the script. But shouldn't it create the file if it doesn't > exist? Which none of them will. > pathlib.PurePath(r'C:\Users\Sayth\Projects\results', file_name) > with open(result_path, 'a') as f: > f.write(data) > ##Output > File

Re: pathlib PurePosixPath

2017-10-10 Thread BlindAnagram
On 10/10/2017 08:44, Sayth Renshaw wrote: > >>> Hi >>> >>> How do I create a valid file name and directory with pathlib? >>> >>> When I create it using PurePosixPath I end up with an OSError due to an >>> obvously invlaid path being created. >> >> You're on Windows. The rules for POSIX paths don'

Re: pathlib PurePosixPath

2017-10-10 Thread Sayth Renshaw
> > Hi > > > > How do I create a valid file name and directory with pathlib? > > > > When I create it using PurePosixPath I end up with an OSError due to an > > obvously invlaid path being created. > > You're on Windows. The rules for POSIX paths don't apply to your file > system, and... > > >

Re: pathlib PurePosixPath

2017-10-10 Thread Chris Angelico
On Tue, Oct 10, 2017 at 6:21 PM, Sayth Renshaw wrote: > Hi > > How do I create a valid file name and directory with pathlib? > > When I create it using PurePosixPath I end up with an OSError due to an > obvously invlaid path being created. You're on Windows. The rules for POSIX paths don't apply

Re: pathlib type error

2015-01-03 Thread Chris Angelico
On Sat, Jan 3, 2015 at 11:06 PM, Chris Angelico wrote: > On Sat, Jan 3, 2015 at 10:55 PM, Georg Grafendorfer > wrote: >> I'm using Debian 8 Jessie on an AMD64 machine. >> Getting this error: >> >> ~$ python3 >> Python 3.4.2 (default, Oct 8 2014, 10:45:20) >> [GCC 4.9.1] on linux > > Unable to re

Re: pathlib type error

2015-01-03 Thread Chris Angelico
On Sat, Jan 3, 2015 at 10:55 PM, Georg Grafendorfer wrote: > I'm using Debian 8 Jessie on an AMD64 machine. > Getting this error: > > ~$ python3 > Python 3.4.2 (default, Oct 8 2014, 10:45:20) > [GCC 4.9.1] on linux > Type "help", "copyright", "credits" or "license" for more information. from