[Python-ideas] Support os.path.join for Windows paths on Posix
Guido van Rossum
guido at python.org
Thu Oct 31 00:12:56 CET 2013
(Sorry, it's not just UNC paths -- it's all paths with drives.)
On Wed, Oct 30, 2013 at 4:09 PM, Guido van Rossum <guido at python.org> wrote:
> Yeah, ntpath doen't know about UNC paths. :-( We should fix this. We
> should also make sure that PEP 428 (pathlib) does this right from day 1.
>
>
> On Wed, Oct 30, 2013 at 3:56 PM, Bruce Leban <bruce at leapyear.org> wrote:
>
>> ntpath still gets drive-relative paths wrong on Windows:
>>
>> >>> ntpath.join(r'\\a\b\c\d', r'\e\f')
>> '\\e\\f'
>> # should be r'\\a\b\e\f'
>>
>> >>> ntpath.join(r'C:\a\b\c\d', r'\e\f')
>> '\\e\\f'
>> # should be r'C:\e\f'
>>
>> (same behavior in Python 2.7 and 3.3)
>>
>> --- Bruce
>> I'm hiring: http://www.cadencemd.com/info/jobs
>> Latest blog post: Alice's Puzzle Page http://www.vroospeak.com
>> Learn how hackers think: http://j.mp/gruyere-security
>>
>>
>> On Wed, Oct 30, 2013 at 3:43 PM, אלעזר <elazarg at gmail.com> wrote:
>>
>>> 2013/10/31 Ryan Gonzalez <rymg19 at gmail.com>:
>>> >>>> import os
>>> >>>> os.path.join('C:\\', 'x.jpg')
>>> > 'C:\\/x.jpg'
>>> >>>>
>>> >
>>> > Isn't something wrong there? My idea: check for \'s in the path. If
>>> there
>>> > are any, assume \ is the path separator, not /.
>>>
>>> No, nothing is wrong:
>>>
>>> C:\Dev>cd C:\/temp
>>>
>>> C:\Temp>
>>> _______________________________________________
>>> Python-ideas mailing list
>>> Python-ideas at python.org
>>> https://mail.python.org/mailman/listinfo/python-ideas
>>>
>>
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>>
>>
>
>
> --
> --Guido van Rossum (python.org/~guido)
>
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131030/8226ec9f/attachment.html>
More information about the Python-ideas
mailing list