tests/readlink.py
author Nicolas Dumazet <nicdumz.commits@gmail.com>
Wed, 08 Apr 2009 14:18:20 +0200
changeset 8021 1c2cf2e5dc9b
parent 5683 396c7010b0cd
child 10282 08a0f04b56bd
permissions -rwxr-xr-x
profiling: dropping hotshot profiling. --profile as a unique profiling option hotshot was an experimental module, which is broken for Python < 2.5 And even for Python >= 2.5 users, hotshot usage is discouraged: cProfile (formerly lsprof) should be used instead.

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