On Thu, 21 Jul 2011 10:27:31 +1000, Mark Hammond <skippy.hammond@gmail.com> wrote:
On 21/07/2011 10:18 AM, Glenn Linderman wrote:
On 7/20/2011 5:07 PM, Nick Coghlan wrote:
On Thu, Jul 21, 2011 at 8:51 AM, Ethan Furman<ethan@stoneleaf.us> wrote:
I would say that would be a cool enhancement, as it could save a bit of typing, but I think the launcher is quite useful even without path traversal. Two related points:
1. Walking PATH isn't necessary, but the cwd of the py process should be inherited from the shell correctly. If it is, then 'py foo.py' shouldn't need path traversal, it should just look in the current directory. Using PATHEXT to turn 'foo.py' directly into an executable command on PATH from any directory is different and out of scope for the launcher.
Sorry, I disagree that it is out of scope. Looking in the current directory is fine, when the script is there, but my scripts are seldom in my data directories, and I want to run scripts (from the PATH) on data that is in the CWD. I consider this a _very common_ use case for using scripts/programs, but then if you want to use py from the command line to tweak which version of Python gets used to execute the script (if the default one didn't work, for example, and you want to try a different one), then suddenly, you have to find the path to the script, and specify it explicitly.
The arguments above apply equally to python.exe. The launcher's job is to find an appropriate python.exe and launch it, not to locate the scripts and all the command-line parsing that would entail. If you want this feature you should advocate for it to be added to Python itself and it will then automatically work in the launcher too.
Indeed. If I want to run a script with a different python version on a unix-like system, I need to know the path to said script. We're trying to make python as easy to use on Windows as it is on Unix. If find-script-on-path is considered a worthwhile feature, then as Mark said it should be added to base Python (on all platforms), not special-cased in the Windows launcher. -- R. David Murray http://www.bitdance.com