view tests/readlink.py @ 16067:467a85ced564 stable

i18n: use util.pconvert() instead of 'str.replace()' for problematic encoding some problematic encodings use backslash as part of multi-byte characters. util.pconvert() can treat strings in such encodings correctly, if win32mbcs is enabled, but str.replace() can not.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 05 Feb 2012 22:58:31 +0900
parents 08a0f04b56bd
children 328739ea70c3
line wrap: on
line source

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