relpath problem on windows

E

eliben

I'm having a problem with 2.6's new os.path.relpath function.

This is correct:

relpath(r'd:\abc\jho', r'd:\abc')
=> 'jho'

But this isn't:
relpath(r'd:\jho', r'd:\\')
=> '..\jho'

Neither is this:
relpath(r'd:\jho', r'd:')
=> '..\..\..\jho'

What am I missing?
 
G

Gabriel Genellina

I'm having a problem with 2.6's new os.path.relpath function.

This is correct:

relpath(r'd:\abc\jho', r'd:\abc')
=> 'jho'

But this isn't:
relpath(r'd:\jho', r'd:\\')
=> '..\jho'

Looks like a real bug to me -- please submit it to http://bugs.python.org/
Neither is this:
relpath(r'd:\jho', r'd:')
=> '..\..\..\jho'

d: means "the current directory on drive d:", and it could be something
like d:\a\b\c
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,297
Messages
2,571,536
Members
48,284
Latest member
alphabetsalphabets

Latest Threads

Top