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

Tiger12506 keridee at jayco.net
Sat Jul 28 17:33:36 CEST 2007


> 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

Wow. I've never heard of this. What are the file's attributes? What does it 
say about the file when you right-click Properties? Hmmm... what's going on 
here? Permission not granted to execute os.stat()? Why wouldn't anyone have 
permission to do that?

A broken symbolic link... That means a hard link that has been cut-off 
right? (Hard-links are like pointers to files in NTFS)  ~ so if the file's 
been moved, that hard link will point to nothing, being broken, right? Does 
anyone know about this? I'm curious.

JS 



More information about the Tutor mailing list