[Tutor] os.path.exists(path) returns false when the path actually exists!

Hugo González Monteverde hugonz-lists at h-lab.net
Sat Jul 28 09:56:07 CEST 2007

Iyer wrote:
>     Adam wrote:
>      From the library documentation:
>     Return True if path refers to an existing path. Returns False for
>     broken symbolic links. On some platforms, this function may return
>     False if permission is not granted to execute os.stat() on the
>     requested file, even if the path physically exists.
>     So the better question is, does is this file a broken symbolic link or
>     can os.stat() be executed on it?
> How do I find if it is a broken symbolic link in Windows 2000 ?
> os.stat(path) returns an OSError saying that there is no such file or 
> directory

Just to check, try to do away with the backslashes. Windows will accept 
a path with forward slashes just as well:



More information about the Tutor mailing list