How to get symlink target in Python?
The problem with os.readlink() is it will only resolve 1 step of the link. We can have a situation where A links to another link B, and B link is dangling. $ ln -s /tmp/example/notexist /tmp/example/B $ ln -s /tmp/example/B /tmp/example/A $ ls -l /tmp/example A -> /tmp/example/B B -> /tmp/example/notexist Now in Python, os.readlink … Read more