best way of testing a program exists before using it?
Nick Craig-Wood
nick at craig-wood.com
Tue Sep 12 10:30:05 EDT 2006
Tim Golden <tim.golden at viacom-outdoor.co.uk> wrote:
> [Nick Craig-Wood]
>
> | Tim Golden <tim.golden at viacom-outdoor.co.uk> wrote:
> | > if os.path.isfile (filepath):
> | > print filepath
> |
> | You might get a more accurate result using
> |
> | os.access(filepath, os.X_OK)
> |
> | instead of
> |
> | os.path.isfile(filepath)
> |
> | Which checks the file is executable
>
> Sadly, not under Win32, hence the shenanigans with
> the PATHEXT variable :)
Make a patch for os.access()? It says in the docs it works on
Windows!
--
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list
mailing list