os.path.realpath() and os.path.abspath()

J

Jurko Gospodnetiæ

Hi all.

os.path.realpath() documentation states that it returns a 'canonical'
path. Does that infer that it returns an absolute path?

I have not found seen any implementation that does not return an
absolute path, but can this be counted on? Or should we use
os.path.abspath(os.path.realpath(x)) when we want to convert x to its
full/canonical name?

Best regards,
Jurko Gospodnetiæ
 
A

Adam Skutt

   Hi all.

   os.path.realpath() documentation states that it returns a 'canonical'
path. Does that infer that it returns an absolute path?

A canonical path is supposed to be absolute and at least Python 2.7.1
ensures that is the case.

Historically, some versions of the UNIX syscall (Solaris in
particular) have not always returned absolute paths, but I believe
this is no longer the case and was a very long standing bug (though I
may be mistaken).

Adam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top