[issue444582] Finding programs in PATH, addition to os

2010-07-08 Thread Andy Buckley

Andy Buckley a...@insectnation.org added the comment:

Personally I think it's a very useful feature: the purpose for running which 
may not be to get the full path to the executable and then run it, but rather 
that that path prefix is important for something else. I'm sure when I joined 
this issue I had some need like that -- after all, as you say, if you just want 
to run it then there are better ways.

In general, once users have a need (for whatever reason) to start firing off 
subprocesses from their Python scripts, things can get ugly. Providing a 
portable path search function provides a way to keep one kind of that ugliness 
inside Python for the cases where it really is needed. As for abuse... well, 
people will always find a way to abuse bits of the library: I think that's an 
issue for them, rather than a reason to block this functionality ;)

My $0.02,
Andy

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-07-08 Thread Erik Demaine

Erik Demaine edema...@mit.edu added the comment:

As mentioned in the original request, there are at least two motivations for 
which functionality that are distinct from running the program (these days, 
with the subprocess module).  #1 was detecting existence of a program.  #2 was 
finding the *second* instance of a program on the path.

After 9 years, I'm certainly not holding my breath...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-07-08 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I apologize for not reading the first post more carefully, thank you for
restating the use cases. I’m +1 now and I’ll review the patches to make
it up :)

Bugs may take years to get fixed. Now that Tarek has expressed interest,
be sure that this won’t get lost again.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-07-04 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Is a “which” function that useful, since we have os.exec* functions that search 
the PATH for us? It seems to me that wanting to know the exact path of an 
executable is a specialized need, and that adding this function would make 
beginners use it instead of the os.exec* family.

--
nosy: +merwok

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-05-19 Thread Christophe Simonis

Changes by Christophe Simonis simonis.christo...@gmail.com:


--
nosy: +Christophe Simonis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-05-19 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
assignee:  - tarek
nosy: +tarek

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-05-19 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

SOunds like a good feature to add in shutil, I'll check the patch and also 
compare it to distutils.spawn.find_executable()

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-05-19 Thread Tarek Ziadé

Tarek Ziadé ziade.ta...@gmail.com added the comment:

@iki: could you refactor your code so it's in shutil (and the tests in 
test_shutil)

few remarks: only which/which_files should be public API,

Next, I don't think extensions like VBS should be hardcoded if PATHEXT is not 
found. A pseudo-dos shell just runs .exe and .com IIRC, if not, there's 
probably somewhere in the win32 environment a list of extensions and their 
associated programs that get called automatically from the shell (in addition 
to PATHEXT). We need to find this list programatically rather that harcoding a 
list that will change from one box to the other.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-05-19 Thread Dan Buch

Changes by Dan Buch daniel.b...@gmail.com:


--
nosy: +meatballhat

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-03-05 Thread Jan Killian

Jan Killian jan.kill...@gmail.com added the comment:

Updated version of reference implementation as a standalone module
* changed interface: which_files() returns generator, which() returns first 
match,
  or raises IOError(errno.ENOENT)
* updated doctest

Made this to more closely resemble the 'which' command behavior, and to make 
the typical use case simpler. The generator interface is still a good idea 
imho, so it's kept as which_files(). I'm already using the reference 
implementation module flawlessly, so I don't see any other changes needed on my 
side. Your ideas are welcome of course.

--
Added file: http://bugs.python.org/file16459/which.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-03-04 Thread Jan Killian

Jan Killian jan.kill...@gmail.com added the comment:

Adapted Brian Curtin's http://bugs.python.org/file15381/
shutil_which.patch and made another reference implementation as a standalone 
module including the following fixes:

* uses ``PATHEXT`` on Windows
* searches current directory before ``PATH`` on Windows, but not before an 
explicitly passed path
* accepts both string or iterable for an explicitly passed path, or pathext
* accepts an explicitly passed empty path, or pathext (either '' or [])
* does not search ``PATH`` for files that have a path specified in their name 
already

Use any of these changes in the final shutil patch if you like to. The shutil 
module has availability 'Unix, Windows' after all.

--
nosy: +iki
Added file: http://bugs.python.org/file16441/which.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2010-01-12 Thread Brian Curtin

Changes by Brian Curtin cur...@acm.org:


--
stage: test needed - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2009-11-22 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

Here is a patch against r76432 which implements a which generator
function in shutil that yields full file paths where the searched file
exists on the PATH. Includes doc change and a test. It is pretty similar
to what edemaine had suggested.

This could just as easily return a list, so if that would be more
preferable I'll change the patch.

--
nosy: +brian.curtin
Added file: http://bugs.python.org/file15381/shutil_which.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2009-11-19 Thread Andy Buckley

Changes by Andy Buckley a...@insectnation.org:


--
nosy: +andybuckley

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2009-11-19 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
nosy:  -brett.cannon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2009-04-22 Thread Daniel Diniz

Changes by Daniel Diniz aja...@gmail.com:


--
dependencies: +replace dist/src/Tools/scripts/which.py with tmick's which
keywords: +easy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2009-03-15 Thread Skip Montanaro

Changes by Skip Montanaro s...@pobox.com:


--
nosy:  -skip.montanaro

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2009-03-11 Thread Tennessee Leeuwenburg

Tennessee Leeuwenburg tleeuwenb...@gmail.com added the comment:

+1 adding which to shutil

--
nosy: +tleeuwenb...@gmail.com

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2009-02-12 Thread Daniel Diniz

Changes by Daniel Diniz aja...@gmail.com:


--
components: +Library (Lib) -None
nosy: +ajaksu2
stage:  - test needed
versions: +Python 2.7, Python 3.1 -Python 2.6, Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue444582
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue444582] Finding programs in PATH, addition to os

2007-08-28 Thread Skip Montanaro

Skip Montanaro added the comment:

Commenting on Brett's reply...  We use this sort
of facility in SpamBayes to search for the OCR
program.  I crafted something by hand which didn't
work on Windows.  Mark Hammond had to clean up the
mess I made.  Having this as a canned function in
os would be handy.

Have a look at find_program in this file:

http://spambayes.svn.sourceforge.net/viewvc/*checkout*/spambayes/trunk/spambayes/spambayes/ImageStripper.py?content-type=text%2Fplain

--
nosy: +skip.montanaro


Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue444582

___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com