Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29782

Re: portable way of locating an executable (like which)

Newsgroups comp.lang.python
Date 2012-09-22 20:55 -0700
References <mailman.973.1348175220.27098.python-list@python.org>
Subject Re: portable way of locating an executable (like which)
From Ramchandra Apte <maniandram01@gmail.com>
Message-ID <mailman.1098.1348372549.27098.python-list@python.org> (permalink)

Show all headers | View raw


On Friday, 21 September 2012 02:37:01 UTC+5:30, gelonida  wrote:
> I'd like to implement the equivalent functionality of the unix command
> 
> /usr/bin/which
> 
> 
> 
> The function should work under Linux and under windows.
> 
> 
> 
> Did anybody already implement such a function.
> 
> If not, is there a portable way of splitting the environment variable PATH?
> 
> 
> 
> Thanks for any sugestions

shutil.which does this in Python 3.3: http://docs.python.org/dev/library/shutil.html#shutil.which
You can copy the code to support older Python versions.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

portable way of locating an executable (like which) Gelonida N <gelonida@gmail.com> - 2012-09-20 23:06 +0200
  Re: portable way of locating an executable (like which) Nobody <nobody@nowhere.com> - 2012-09-21 00:59 +0100
    Re: portable way of locating an executable (like which) Tarek Ziadé <tarek@ziade.org> - 2012-09-21 10:12 +0200
  Re: portable way of locating an executable (like which) Ramchandra Apte <maniandram01@gmail.com> - 2012-09-22 20:55 -0700
  Re: portable way of locating an executable (like which) Ramchandra Apte <maniandram01@gmail.com> - 2012-09-22 20:55 -0700

csiph-web