Windows: subprocess won't run different Python interpreter

Ethan Furman ethan at stoneleaf.us
Fri Nov 11 10:57:06 EST 2016


On 11/11/2016 03:24 AM, eryk sun wrote:
> On Fri, Nov 11, 2016 at 10:46 AM, Thorsten Kampe wrote:

>> My goal is to verify that other shells/interpreters on Windows work
>> the same way as Python when running an application or creating a sub-
>> process. Cmd does not. What's else there? I have Bash here but that's
>> a Cygwin executable. And Cygwin Python does not work like Windows
>> Python.

> Since subprocess.Popen doesn't call ShellExecuteEx, it would make no
> sense for it to use a custom search that tries appending all of the
> file extensions in %PathExt%. Thus the only case for Popen to
> implement its own search is to avoid the implicit directories that
> CreateProcess searches ahead of %Path%. But implicitly searching the
> application directory and system directories ahead of %Path% is a
> feature for Windows applications, and Python is primarily an
> application development language on Windows -- not a system
> administration language that takes the place of the shell.

Due to backwards compatibility this is unlikely to change.  However, if you can make the case that this missing functionality is important then perhaps one more parameter can be specified to Popen, or a new command added to subprocess, that deals with it.

See https://mail.python.org/pipermail/python-ideas/2016-November/043620.html for some good ideas on what would be needed for such a proposal.

--
~Ethan~




More information about the Python-list mailing list