os independent way of seeing if an executable is on the path?

Trent Mick trentm at ActiveState.com
Thu May 26 15:37:11 EDT 2005


> > In Windows, I can read the error file, and get something like:
> > "'<program name>' is not recognized as an internal or external
> > command,\noperable program or batch file.\n"
> > and I'm sure I could parse this, but this seems fragile, and clearly os
> > dependent.

http://starship.python.net/crew/tmick/#which

I have a 'which' implementation that looks up a command-line program
name in the same way that Windows' process launching does at the shell
(when on Windows) and in the same way the usual 'which' executable does
on Un*x (when on Un*x).

Trent

-- 
Trent Mick
TrentM at ActiveState.com



More information about the Python-list mailing list