[issue14550] os.path.abspath() returns physical path, not logical path.

Craig Sawyer report at bugs.python.org
Wed Apr 11 19:17:50 CEST 2012


New submission from Craig Sawyer <csawyer at yumaed.org>:

we have os.path.abspath() and os.path.realpath().  the difference according to the documentation is realpath() returns the physical path (i.e. no symlinks in the path).  while abspath() uses getcwd() but because of POSIX.1-2008 (IEEE Std 1003.1-2008) says os.getcwd() returns without symbolic links as well, so os.path.abspath() == os.path.realpath() near as I can tell.

I think os.path.abspath() should return a logical path(i.e. one with symlinks).  The only solution I know of is to getenv('PWD') except that is not guaranteed to be around in POSIX (some BSD's don't offer PWD I understand).  The other option is to ask /bin/pwd which is part of the POSIX standard.

Anyways, I couldn't find a previous bug around this issue, but I think there should be a way in the standard library to get a logical path, as well as a realpath().

----------
components: None
messages: 158056
nosy: csawyer-yumaed
priority: normal
severity: normal
status: open
title: os.path.abspath() returns physical path, not logical path.
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14550>
_______________________________________


More information about the Python-bugs-list mailing list