stat.S_ISLNK and os.path.islink

Andrew MacKeith mackeith at hks.com
Tue Oct 30 09:53:31 EST 2001


Has anyone seen 

    os.path.islink(path)
 
return a different result to 

    stat.S_ISLNK(os.stat(path)[stat.ST_MODE])
?

The directory in question is a symbolic link.

My result, on IRIX, is as follows:
(lines split up for readability)
The path is a symbolic link to a directory.

> python21 -c "import os,stat;
s = os.stat('../removeStar/is_base_link')[stat.ST_MODE];
print s, stat.S_IFMT(s);
print stat.S_ISLNK(s);
print os.path.islink('../removeStar/is_base_link')"
16872 16384
0
1


Andrew MacKeith



More information about the Python-list mailing list