Does os.path relpath produce an incorrect relative path?

BlindAnagram BlindAnagram at nowhere.org
Sat May 27 05:21:34 EDT 2023


On 26/05/2023 16:42, Eryk Sun wrote:
> On 5/26/23, cactus <riemannic at gmail.com> 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 Python 3.12, the relative_to() method has a walk_up
> parameter. It defaults to False for the sake of backward
> compatibility.
> 
> https://docs.python.org/3.12/library/pathlib.html#pathlib.PurePath.relative_to

Thanks, it is good to know that this is coming.

   Brian




More information about the Python-list mailing list