[docs] os.readlink recipe for getting an absolute path

Sébastien Barthélemy barthelemy at crans.org
Fri Jul 9 14:36:39 CEST 2010


In the doc of os.readlink [1], it is stated:
"Return a string representing the path to which the symbolic link
points. The result may be either an absolute or relative pathname; if
it is relative, it may be converted to an absolute pathname using
os.path.join(os.path.dirname(path), result)."

However, if `path` is relative, the result of this command will be
relative, which makes the documentation inaccurate.

The wording should be changed or the command updated to something like:
os.path.join(os.path.abspath(os.path.dirname(path)), result)

[1] http://docs.python.org/library/os.html#os.readlink

Cheers, and many thanks for the wonderful documentation


More information about the docs mailing list