tests/readlink.py
author Brodie Rao <brodie@bitheap.org>
Wed, 18 Aug 2010 10:53:52 -0400
branchstable
changeset 11987 3145951e50fe
parent 10282 08a0f04b56bd
child 25660 328739ea70c3
permissions -rwxr-xr-x
convert: use encoding.encoding instead of locale.getpreferredencoding() The latter may not return useful results in certain OS X environments.

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