best way of testing a program exists before using it?

Duncan Booth duncan.booth at invalid.invalid
Tue Sep 12 13:31:12 EDT 2006


"Tim Golden" <tim.golden at viacom-outdoor.co.uk> wrote:

> All that said, I think the only thing would be to add a line to
> the docs saying sthg like: This will always return False for X_OK under
> Win32. I'm happy to submit the patch, but is it worth it?

+1 on documenting the actual behaviour under windows. -1 on saying it 
always returns False since it doesn't. It seems to return True if the file 
exists including things like 'C:' or 'aux:'.

Bizarrely it seems that it even returns True for files in a folder for 
which the user has no access. This isn't entirely surprising 
('os.access(filename, os.R_OK)' returns True for unreadable files on 
windows), but it does seem odd as it provides a way of verifying the 
existence of files when you can't list the directory.



More information about the Python-list mailing list