This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mhammondr
Recipients mhammondr
Date 2021-05-08.15:43:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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/", 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:11mhammondrsetrecipients: + mhammondr
2021-05-08 15:43:11mhammondrsetmessageid: <>
2021-05-08 15:43:11mhammondrlinkissue44078 messages
2021-05-08 15:43:11mhammondrcreate