File Path retrieving problem

Emile van Sebille emile at fenx.com
Wed Feb 25 16:35:34 EST 2009


Peter Otten wrote:
> Maybe it's about access rights?
> 
> $ mkdir alpha
> $ touch alpha/beta
> $ python -c"import os; print os.path.exists('alpha/beta')"
> True
> $ chmod u-x alpha
> $ python -c"import os; print os.path.exists('alpha/beta')"
> False
> $
> 
> I Don't know how this is handled on Windows...
> 

Here's one way....

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>mkdir alpha
C:\>touch alpha\beta  # cygwin at work here...

C:\>python -c"import os; print os.path.exists('alpha/beta')"
True

C:\>cacls alpha /E /R "Everyone"
processed dir: C:\alpha
C:\>cacls alpha /E /R "Users"
processed dir: C:\alpha
C:\>cacls alpha /E /R "Administrators"
processed dir: C:\alpha

C:\>python -c"import os; print os.path.exists('alpha/beta')"
False




More information about the Python-list mailing list