On 26/05/2023 16:42, Eryk Sun wrote:
On 5/26/23, cactus wrote:
Surprisingly (for me at least) the alternative provided by the pathlib
module 'relative_to' method doesn't provide for full relative path
computation. I was expecting this would offer everything that os.path
offers but it doesn't
On 5/26/23, cactus wrote:
>
> Surprisingly (for me at least) the alternative provided by the pathlib
> module 'relative_to' method doesn't provide for full relative path
> computation. I was expecting this would offer everything that os.path
> offers but it doesn't in this case.
Starting with
On Thursday, 25 May 2023 at 17:57:21 UTC+1, MRAB wrote:
> On 2023-05-25 16:53, Eryk Sun wrote:
> > On 5/25/23, BlindAnagram wrote:
> >>
> >> vcx_path = 'C:\\build.vs22\\lib\\lib.vcxproj'
> >> src_path = 'C:\\lib\\src\\'
> >> rel_path = '..\\..\\..\\lib\\src'
> >>
> >> [snip]
> >>
> >> The
On 2023-05-25 16:53, Eryk Sun wrote:
On 5/25/23, BlindAnagram wrote:
vcx_path = 'C:\\build.vs22\\lib\\lib.vcxproj'
src_path = 'C:\\lib\\src\\'
rel_path = '..\\..\\..\\lib\\src'
[snip]
The first of these three results produces an incorrect relative path
because relpath does not strip off any
On 25/05/23 7:49 pm, BlindAnagram wrote:
The first of these three results produces an incorrect relative path
because relpath does not strip off any non-directory tails before
comparing paths.
It has no way of knowing whether a pathname component is a directory
or not. It's purely an
On 5/25/23, BlindAnagram wrote:
>
> vcx_path = 'C:\\build.vs22\\lib\\lib.vcxproj'
> src_path = 'C:\\lib\\src\\'
> rel_path = '..\\..\\..\\lib\\src'
>
> [snip]
>
> The first of these three results produces an incorrect relative path
> because relpath does not strip off any non-directory tails
I am wondering whether I have misunderstood the semantics of os.path
relpath or whether it has a bug.
Here is a short test program:
---
from os.path import relpath, split
src_path = 'C:\\lib\\src\\'
vcx_path =