Python equivalent to 'which'?

Michael Gilfix mgilfix at eecs.tufts.edu
Wed Jul 31 10:21:03 EDT 2002


  This module looks pretty good and does seem kinda appropriate. I wonder
why Tent Mick hasn't suggested it?

                    -- Mike

On Tue, Jul 30 @ 10:54, David Ascher wrote:
> Doing 'which' right is actually fairly complicated -- Trent Mick has the 
> best version I know of at: http://starship.python.net/~tmick/
> 
> """
> GNU which is a common command line app on Unix. There are Windows ports 
> (for example, the one in the Cygwin distribution), though I find the 
> ones I have seen to be a little stupid. They don't understand the use of 
> the PATHEXT environment variable. They don't support the useful '-a' 
> option to listing all matches on the current PATH.
> 
> This which has the following features:
> 
> it is portable (Windows, Linux);
> it understands PATHEXT on Windows;
> it can print all matches on the PATH;
> it can note "near misses" on the PATH (e.g. files that match but may 
> not, say, have execute permissions); and
> it can be used as a Python module.
> """
`-> (DavidA)

-- 
Michael Gilfix
mgilfix at eecs.tufts.edu

For my gpg public key:
http://www.eecs.tufts.edu/~mgilfix/contact.html




More information about the Python-list mailing list