os.readlink() doco snafu?
wilson at afn.org
Wed Aug 20 21:11:51 CEST 2008
English is my first language, but I doesn't be very good at it.
I was trying to endow my symlinked python module with the ability to
divine where it actually resides when I came across os.readlink(),
documented at http://docs.python.org/lib/os-file-dir.html
I'm not sure readlink() lives up to its documentation. To wit:
$ touch bar # Create an empty file
$ ln -s bar foo # And a symlink to it.
Python 2.5.1 <... Herald "the snitch" Redacted ...>
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, os.path
>>> path = "foo"
>>> result = os.readlink(path)
>>> abspath = os.path.join(os.path.dirname(path), result)
The result makes sense, but it belies the documentation. Should I report
this? Or is there another plausible interpretation?
More information about the Python-list