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


Groups > comp.lang.python > #82891

Re: is pathlib Path.resolve working as intended?

Subject Re: is pathlib Path.resolve working as intended?
From Chris Cioffi <chris@evenprimes.com>
Date 2014-12-24 09:09 -0500
References <203896CA-3C8E-4BFA-9657-5A1749EF52CC@evenprimes.com> <CANc-5UxE8_h9OnqAj+jSFrknU4G-yTYc0azS+JptYPbKtc9=bw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.17184.1419432378.18130.python-list@python.org> (permalink)

Show all headers | View raw


That's what I thought as well.  Then I found https://bugs.python.org/issue19776 and it looks like this is a well known issue.  Hopefully the patches are working and will be accepted in the next release or so.  

Given how often os.path.expanduser() is needed, I'm a little surprised that the pathlib module was even put in provisionally.  I do like how it works, however.  Paths as objects and not strings!  Its a beautiful idea, just not 100% complete.

PS:  For those who are curious, the 2 issues that seemed to hold things up the most are non-Unix systems (Windows) and how to handle when there is no home directory.  Posix only says that the results are undefined.  

> On Dec 24, 2014, at 8:38 AM, Skip Montanaro <skip.montanaro@gmail.com> wrote:
> 
>>>> p.resolve()
> ...
> FileNotFoundError: [Errno 2] No such file or directory: '/Users/chris/~'
> 
> I've not used the pathlib module yet, but poked through the
> documentation. Oddly enough, I saw no mention of "~". The doc for the
> resolve method only mentions resolving symlinks. In addition, the
> pathlib doc doesn't mention "expand" either.
> 
> My guess is your working directory was /Users/chris, and that "~"
> expansion isn't supported by pathlib. Even so, it seems like a common
> enough task that I'd open a bug report/feature request at
> bugs.python.org.
> 
> Skip

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


Thread

Re: is pathlib Path.resolve working as intended? Chris Cioffi <chris@evenprimes.com> - 2014-12-24 09:09 -0500

csiph-web