os.path query functions behavior incorrect?

Georg Brandl g.brandl at gmx.net
Tue Apr 5 15:33:36 EDT 2005


wittempj at hotmail.com wrote:
> It works fine under linux
> martin at ubuntu:~ $ python
> Python 2.3.4 (#2, Feb  2 2005, 11:10:56)
> [GCC 3.3.4 (Debian 1:3.3.4-9ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import os.path
>>>> os.path.exists('/blah')
> False
>>>> os.path.isdir('/blah')
> False
>>>> os.path.isdir('/home/martin')
> True
>>>> os.path.exists('/home/martin')
> True
>>>>

Of course it does. This is not a problem with Unix-style filesystems
because there a directory either exists or not. However, under Windows,
the drive letters for floppies or CDs exists even if there is no media
inserted. It is, of course, questionable whether isdir() and exists()
should return True in this case.

mfg
Georg



More information about the Python-list mailing list