tests/readlink.py
author Simon Heimberg <simohe@besonet.ch>
Sat, 12 Nov 2011 02:07:55 +0100
changeset 15492 36f076d03b34
parent 10282 08a0f04b56bd
child 25660 328739ea70c3
permissions -rwxr-xr-x
setup: make script executable with python3 Replace the incompatible print statement. Writing a warning to stderr is a good idea anyway.

#!/usr/bin/env python

import errno, os, sys

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

sys.exit(0)