tests/readlink.py
author Yuya Nishihara <yuya@tcha.org>
Sat, 03 Oct 2015 18:48:21 +0900
changeset 26453 1a2578418689
parent 25660 328739ea70c3
child 29175 7bcfb9090c86
permissions -rwxr-xr-x
pager: rename variables of backup fds The next patch will add backup file objects, so the original variable names would be confusing.

#!/usr/bin/env python

import errno, os, sys

for f in sys.argv[1:]:
    try:
        print f, '->', os.readlink(f)
    except OSError as err:
        if err.errno != errno.EINVAL:
            raise
        print f, 'not a symlink'

sys.exit(0)