If I call os.stat()
on a broken symlink
, python throws an OSError
exception. This makes it useful for finding them. However, there are a few other reasons that os.stat()
might throw a similar exception. Is there a more precise way of detecting broken symlinks
with Python under Linux?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
os.lstat() may be helpful. If lstat() succeeds and stat() fails, then it's probably a broken link.