[Tutor] os.path.exists(path) returns false when the path actually exists!

John Fouhy john at fouhy.net
Tue Jul 31 02:58:34 CEST 2007


On 31/07/07, Iyer <maseriyer at yahoo.com> wrote:
> os.path.exists("c:/winnt/file_name")
>
> Nope, even, with the use of forward slashes in the path, it still returns
> false
>
>  What am I doing wrong here ?

Type 'os.listdir("c:/winnt")' and see what it gives you.  I haven't
looked at the code, but I presume 'os.path.exists(s)' is roughly
equivalent to 'os.path.split(s)[1] in
os.listdir(os.path.split(s)[0])'.

-- 
John.


More information about the Tutor mailing list