Walking The Right Path

Tim Daneliuk tundra at tundraware.com
Mon Jan 8 11:43:53 EST 2007


Tim Daneliuk wrote:
> Jakub Stolarski wrote:
>> Tim Daneliuk napisal(a):

>>> IOW, is there a way to return a symlink-based path which contains
>>> the symlink pointer as is was *defined* not as it expands?
>>>
>>
>> One way (but very ugly):
>> print os.path._resolve_link('/bar')
>>
> 
> Yup, that does just what I want.  By why, pray tell, do you consider it
> ugly ...?
> 
> 

Whoops - that doesn't do it either.  If I have this:

/foo -> /usr/bar
/usr/bar -> /usr1/bar

Then realpath or _resolve_link both return "/usr1/bar" when given "/foo"
(when what I want is "/usr/bar").  There is obviously some underlying
OS support to do this (in this case FreeBSD 4.x) because 'ls' shows
things as I prefer them - i.e. Links are shown as assigned not how they
actually resolve...
-- 
----------------------------------------------------------------------------
Tim Daneliuk     tundra at tundraware.com
PGP Key:         http://www.tundraware.com/PGP/



More information about the Python-list mailing list