Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   os.path.realpath() and os.path.abspath() (http://www.velocityreviews.com/forums/t741844-os-path-realpath-and-os-path-abspath.html)

Jurko GospodnetiŠ 01-11-2011 11:35 AM

os.path.realpath() and os.path.abspath()
 
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Š


Adam Skutt 01-12-2011 03:30 AM

Re: os.path.realpath() and os.path.abspath()
 
On Jan 11, 6:35*am, Jurko GospodnetiŠ <jurko.gospodne...@pke.hr>
wrote:
> * *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


All times are GMT. The time now is 12:13 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.