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.

classification
Title: os.path.relpath fails when path == start
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, townerj
Priority: normal Keywords:

Created on 2008-01-06 12:14 by townerj, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg59358 - (view) Author: Jesse Towner (townerj) Date: 2008-01-06 12:18
os.path.relpath fails with an exception on both Windows and Unix systems
(ntpath and posixpath modules) when the given path and the start path
are equal. Better behavior here might be to return an empty string or
perhaps os.path.curdir.

>>> os.path.relpath("test", "test")
Traceback (most recent call last):
  File "<pyshell#40>", line 1, in <module>
    os.path.relpath("test", "test")
  File "C:\Program Files\Python3K\Lib\ntpath.py", line 495, in relpath
    return join(*rel_list)
TypeError: join() takes at least 1 positional argument (0 given)
msg59374 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-06 14:27
Thanks, fixed in r59770.
History
Date User Action Args
2022-04-11 14:56:29adminsetgithub: 46083
2008-01-06 14:27:26georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg59374
nosy: + georg.brandl
2008-01-06 12:18:25townerjsetmessages: + msg59358
2008-01-06 12:14:00townerjcreate