stat.S_ISLNK and os.path.islink

Michael Hudson mwh at python.net
Tue Oct 30 15:58:48 CET 2001


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



More information about the Python-list mailing list