Test whether a path is a symbolic link
(path)
| 59 | # This will always return false on systems where os.lstat doesn't exist. |
| 60 | |
| 61 | def islink(path): |
| 62 | """Test whether a path is a symbolic link""" |
| 63 | try: |
| 64 | st = os.lstat(path) |
| 65 | except (OSError, ValueError, AttributeError): |
| 66 | return False |
| 67 | return stat.S_ISLNK(st.st_mode) |
| 68 | |
| 69 | |
| 70 | # Is a path a junction? |
no test coverage detected
searching dependent graphs…