Message393262
Comparing two paths, PurePath.relative_to fails with ValueError if the second path is not in the first.
>>> Path('/a/b').relative_to('/a/b/c')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.9/pathlib.py", line 928, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/a/b' is not in the subpath of '/a/b/c' OR one path is relative and the other is absolute.
Please extend PurePath.relative_to so it is able to output a relative path in form of '..' instead of an error. Currently, the only way to do this is to use relpath from os.path but it would be very useful if Path was able to output the relative path. |
|
Date |
User |
Action |
Args |
2021-05-08 15:43:11 | mhammondr | set | recipients:
+ mhammondr |
2021-05-08 15:43:11 | mhammondr | set | messageid: <1620488591.33.0.62171873486.issue44078@roundup.psfhosted.org> |
2021-05-08 15:43:11 | mhammondr | link | issue44078 messages |
2021-05-08 15:43:11 | mhammondr | create | |
|