os.readlink returning value

Tim Roberts timr at probo.com
Fri Nov 2 06:56:41 CET 2007


Giampaolo Rodola' <gnewsg at gmail.com> wrote:
>
>I was reading os.readlink doc which says:
>
>readlink( path)
>
>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). Availability: Macintosh,
>Unix.
>
>...It's not clear to me when the returning result could be absolute
>and when it could be relative.
>Could someone clarify this point?

It will be relative if the symbolic link is relative, and absolute if the
symbolic link is absolute.

  ln -s ../../over/there here1
  ln -s /home/timr/spot here2

"here1" is a relative link.  "here2" is an absolute link.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list