Checking if the file is a symlink fails

Christian Heimes lists at cheimes.de
Thu Aug 28 18:11:17 EDT 2008


saswat at gmail.com wrote:
> File symLinkTest is a symbolic link.
> 
> Why S_ISLNK(mode) returns False and S_ISREG(mode) returns True ?

Because you are using os.stat() instead of os.lstat().

http://docs.python.org/lib/os-file-dir.html

Christian




More information about the Python-list mailing list