[Patches] [ python-Patches-1068277 ] os.path.exists returns False if no permission

SourceForge.net noreply at sourceforge.net
Sat Jul 29 21:57:20 CEST 2006


Patches item #1068277, was opened at 2004-11-17 16:20
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1068277&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.5
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Robert Brewer (aminusfu)
>Assigned to: A.M. Kuchling (akuchling)
Summary: os.path.exists returns False if no permission

Initial Comment:
A single new sentence for os.path.exists description,
which makes it clear that it may return False even if
the path actually exists.

----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2006-07-29 15:57

Message:
Logged In: YES 
user_id=11375

Fred approved this patch, so I've tweaked it a little and committed it.  (rev. 
50950 on the trunk, 50951 on the release24-maint branch.)

If we want to change the underlying implementation (and hence semantics) of 
os.path.exists(), I think that should be a PEP, or at least a separate bug.


----------------------------------------------------------------------

Comment By: Armin Rigo (arigo)
Date: 2004-12-20 09:53

Message:
Logged In: YES 
user_id=4771

Actually, what about the following ?

    def exists(path):
        return os.access(path, os.F_OK)

It returns True on all existing directory entries apart from broken links and links pointing within unreadable directories.

I don't see any similar nice solution for the more recent os.path.lexists()...  There are cases where the above exists() returns True but the current lexists() returns False, which is strange because lexists() is supposed to be a more permissive version of exists().

----------------------------------------------------------------------

Comment By: Armin Rigo (arigo)
Date: 2004-12-20 08:00

Message:
Logged In: YES 
user_id=4771

I don't see an obvious way to do it, but shouldn't os.path.exists() try harder to return the expected answer?

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2004-12-05 01:56

Message:
Logged In: YES 
user_id=3066

This should be committed on the trunk and release24-maint
branch.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1068277&group_id=5470


More information about the Patches mailing list