Mercurial > hg
view tests/readlink.py @ 29433:33770d2b6cf9
py3: conditionalize SocketServer import
The SocketServer is renamed to socketserver in python 3
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 27 Jun 2016 16:48:54 +0530 |
parents | 7bcfb9090c86 |
children | 6a98f9408a50 |
line wrap: on
line source
#!/usr/bin/env python from __future__ import print_function import errno, os, sys for f in sys.argv[1:]: try: print(f, '->', os.readlink(f)) except OSError as err: if err.errno != errno.EINVAL: raise print(f, '->', f, 'not a symlink') sys.exit(0)