Test whether a path is a symbolic link. This will always return false for Windows prior to 6.0.
(path)
| 254 | # This will always return false on systems where os.lstat doesn't exist. |
| 255 | |
| 256 | def islink(path): |
| 257 | """Test whether a path is a symbolic link. |
| 258 | This will always return false for Windows prior to 6.0. |
| 259 | """ |
| 260 | try: |
| 261 | st = os.lstat(path) |
| 262 | except (OSError, ValueError, AttributeError): |
| 263 | return False |
| 264 | return stat.S_ISLNK(st.st_mode) |
| 265 | |
| 266 | # Being true for dangling symbolic links is also useful. |
| 267 |
no test coverage detected