FAQ
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

1


Andrew MacKeith

Search Discussions

  • Michael Hudson at Oct 30, 2001 at 2:58 pm

    Andrew MacKeith <mackeith at hks.com> writes:

    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.
    os.stat follows symbolic links! Try os.lstat instead.

    Cheers,
    M.

    --
    Never meddle in the affairs of NT. It is slow to boot and quick to
    crash. -- Stephen Harris
    -- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedOct 30, '01 at 2:53p
activeOct 30, '01 at 2:58p
posts2
users2
websitepython.org

2 users in discussion

Michael Hudson: 1 post Andrew MacKeith: 1 post

People

Translate

site design / logo © 2022 Grokbase