[Python-bugs-list] [ python-Bugs-513572 ] isdir behavior getting odder on UNC path

noreply@sourceforge.net noreply@sourceforge.net
Fri, 08 Feb 2002 14:05:51 -0800


Bugs item #513572, was opened at 2002-02-05 18:07
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=513572&group_id=5470

Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Gary Herron (herron)
>Assigned to: Tim Peters (tim_one)
Summary: isdir behavior getting odder on UNC path

Initial Comment:
It's been documented in earlier version of Python on 
windows that os.path.isdir returns true on a UNC 
directory only if there was an extra backslash at the 
end of the argument.  In Python2.2 (at least on 
windows 2000) it appears that *TWO* extra backslashes 
are needed.

Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for 
more information.
>>>
>>> import os
>>> os.path.isdir('\\trainer\island')
0
>>> os.path.isdir('\\trainer\island\')
0
>>> os.path.isdir('\\trainer\island\\')
1
>>>

In a perfect world, the first call should return 1, 
but never has.  In older versions of python, the 
second returned 1, but no longer.

In limited tests, appending 2 or more backslashes to 
the end of any pathname returns the correct answer in 
both isfile and isdir.


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-02-08 14:05

Message:
Logged In: YES 
user_id=6380

Tim, I hate to do this to you, but you're the only person I
trust with researching this. (My laptop is currently off the
net again. :-( )


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=513572&group_id=5470