tests/readlink.py
author Brodie Rao <brodie@sf.io>
Sun, 13 May 2012 13:18:06 +0200
changeset 16705 c2d9ef43ff6c
parent 10282 08a0f04b56bd
child 25660 328739ea70c3
permissions -rwxr-xr-x
check-code: ignore naked excepts with a "re-raise" comment This also promotes the naked except check from a warning to an error.

#!/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)