Bugs item #516232, was opened at 2002-02-11 19:50 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=516232&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Extension Modules Group: Python 2.2 >Status: Closed >Resolution: Wont Fix Priority: 5 Submitted By: Charles I. Fuller (cifuller) Assigned to: Nobody/Anonymous (nobody) Summary: Windows os.path.isdir bad if drive only Initial Comment: It seems that most os functions recognize the Windows drive letter without a directory as the current directory on the drive, but os.path.isdir still returns 0. If os.listdir('C:') returns data, os.path.isdir('C:') should return 1 for consistency. C:\folder_on_C>python 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.system('dir C:') Volume in drive C has no label. Volume Serial Number is E4C9-AD16 Directory of C:\folder_on_C 02/11/2002 05:29p <DIR> . 02/11/2002 05:29p <DIR> .. 02/11/2002 05:29p <DIR> subA 02/11/2002 05:29p <DIR> subB 0 File(s) 0 bytes 4 Dir(s) 22,126,567,424 bytes free 0 >>> os.listdir('C:') ['subA', 'subB'] >>> os.path.abspath('C:') 'C:\folder_on_C' >>> os.path.isdir('C:') 0 ---------------------------------------------------------------------- Comment By: Facundo Batista (facundobatista) Date: 2005-05-30 15:00 Message: Logged In: YES user_id=752496 Deprecated. Reopen only if still happens in 2.3 or newer. . Facundo ---------------------------------------------------------------------- Comment By: Facundo Batista (facundobatista) Date: 2005-03-21 16:30 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as "Won't fix". Thank you! . Facundo ---------------------------------------------------------------------- Comment By: Tim Peters (tim_one) Date: 2002-02-12 19:33 Message: Logged In: YES user_id=31435 Well, the underlying Microsoft routines are themselves inconsistent, and in undocumented ways. We make a mild effort to hide their warts, but it's historical truth that doing so introduces other bugs. The sad fact is that MS stat() insists "C:" does not exist, but the MS FindFirstFile happily accepts "C:". If you think *you* can straigten this inherited mess out, happy to accept a patch <wink>. ---------------------------------------------------------------------- Comment By: Charles I. Fuller (cifuller) Date: 2002-02-12 18:54 Message: Logged In: YES user_id=211047 Responding to Tim's followup... In this case the 'C:' is not the root drive, it is the current dir on that drive. I noticed that os.path.abspath was updated between 2.0 and 2.2 to recognize the current dir. It's an inconsistency that tripped me up already. >>> os.path.isdir('C:') 0 >>> os.path.isdir(os.path.abspath('C:')) 1 The listdir has been working with drive specs (recognizing the current dir) for a while. The abspath code must be handling the drive-only input as a special case. The isdir function should do the same for consistency. There should at least be a warning in the docs... ---------------------------------------------------------------------- Comment By: Tim Peters (tim_one) Date: 2002-02-11 20:16 Message: Logged In: YES user_id=31435 Sorry, this is how Microsoft's implementation of the underlying stat() function works. "Root drive" paths must be given with a trailing slash or backslash, else MS stat() claims they don't exist. You'll see the same irritating behavior in C code. Attempts to worm around it in the past have introduced other bugs; see bug 513572 for a current example. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=516232&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com