[New-bugs-announce] [issue7195] Value error 'path is on drive c: start on drive d:' in os.path.relpath

Jason R. Coombs report at bugs.python.org
Fri Oct 23 23:39:23 CEST 2009


New submission from Jason R. Coombs <jaraco at jaraco.com>:

A simple test fails:

Python 2.6.3 (r263rc1:75186, Oct 2, 2009, 20:40:30) [MSC v.1500 32 bit
(Intel)] on win32
>>> import os
>>> os.path.relpath('\\bar', 'd:\\')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python\lib\ntpath.py", line 487, in relpath
    % (path_list[0], start_list[0]))
ValueError: path is on drive C:, start on drive d:

If I change the current directory to 'E:\', the error changes to "path
is on drive E:, start on drive d:".

Clearly, relpath is doing some calculations based on the current
directory, although the documentation states that it should be
performing a relative path calculation based on the supplied start
("D:\" in this case).

In Python 3.1.1, the error is "path is on mount 'C:', start on mount 'd:'"

os.path.relpath should be able to perform relative path calculations
regardless of the current directory, or the documentation should explain
why the current directory is relevant when start is supplied.

----------
components: Windows
messages: 94394
nosy: jaraco
severity: normal
status: open
title: Value error 'path is on drive c: start on drive d:' in os.path.relpath
type: behavior
versions: Python 2.6, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7195>
_______________________________________


More information about the New-bugs-announce mailing list