On 5/25/23, BlindAnagram <blindanag...@nowhere.org> 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 before
> comparing paths.

The start path is assumed to be a directory, which defaults to the
current working directory, and the input paths are first resolved as
absolute paths. In order to reach src_path from vcx_path, one has to
traverse 3 levels up to the root directory.

https://docs.python.org/3/library/os.path.html#os.path.relpath
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to