[issue15531] os.path symlink docs missing
New submission from Dave Abrahams:
the docs for os.path don't mention the following facts which I think are important (in fact I assumed the facts would be the reverse):
os.path.realpath(l) works when l is a broken symbolic link, returning the path to the (missing) target
os.path.readlink(l) causes an error when l is a broken symbolic link.
----------
assignee: docs@python
components: Documentation
messages: 167163
nosy: dabrahams, docs@python
priority: normal
severity: normal
status: open
title: os.path symlink docs missing
type: enhancement
versions: Python 2.7
_______________________________________
Python tracker
R. David Murray added the comment:
The first of those acts as I would expect: os.path.realpath is operating only on the path, so if the last element is a symbolic link it doesn't have any reason to look for the target of that link.
The second one does seem less intuitive.
I'm not sure the first case is worth a patch...I'd have to see a suggested wording. The second probably is, assuming it is not in fact a bug.
----------
nosy: +larry, r.david.murray
_______________________________________
Python tracker
Larry Hastings added the comment:
I just tried it, and os.readlink('/tmp/broken-symlink') worked fine. What OS are you using?
----------
_______________________________________
Python tracker
Dave Abrahams added the comment:
MacOS 10.7
----------
_______________________________________
Python tracker
Larry Hastings added the comment:
What does the following script print out?
import os
os.chdir('/tmp')
os.symlink('--success--', 'foo')
print("this should print --success-- :")
print(os.readlink('foo'))
os.unlink('foo')
----------
_______________________________________
Python tracker
Dave Abrahams added the comment:
on Sat Aug 04 2012, Larry Hastings
Larry Hastings added the comment:
What does the following script print out?
import os
os.chdir('/tmp') os.symlink('--success--', 'foo') print("this should print --success-- :") print(os.readlink('foo')) os.unlink('foo')
--8<---------------cut here---------------start------------->8---
this should print --success-- :
--success--
--8<---------------cut here---------------end--------------->8---
So, I guess I don't know what was causing the symptom I observed.
----------
_______________________________________
Python tracker
Larry Hastings added the comment:
Since everything is working fine, and the documentation arguably needs no update, I'm closing this.
----------
resolution: -> works for me
stage: -> committed/rejected
status: open -> closed
_______________________________________
Python tracker
participants (3)
-
Dave Abrahams
-
Larry Hastings
-
R. David Murray