Checking if the file is a symlink fails

Christian Heimes lists at cheimes.de
Fri Aug 29 00:11:17 CEST 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