[issue20894] COMSPEC with multiple paths breaks subprocess.call

Elja van Tol report at bugs.python.org
Wed Mar 12 11:02:25 CET 2014


New submission from Elja van Tol:

I tried a simple console command:
 import subprocess
 subprocess.call(["dir"], shell=True)

Which failed with an WindowsError 2, (could not find file)

After much googling i found out that this is caused by os.environ['COMSPEC']
(http://stackoverflow.com/questions/20330385/cannot-find-the-file-specified-when-using-subprocess-calldir-shell-true-in#comment30370433_20335954)

At first my COMSPEC was:
C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\welja\AppData\Roaming\Composer\vendor\phpunit\phpunit;C:\Python27;

I added ;%SystemRoot%\System32\cmd.exe but that failed.

I then changed COMSPEC to only contain %SystemRoot%\System32\cmd.exe and that worked.

( Please fix this for others like me, users stuck on windows with no knowlegde of Python who just try to get Fabric to work to deploy some PHP sites :) )

----------
components: Windows
messages: 213234
nosy: elja
priority: normal
severity: normal
status: open
title: COMSPEC with multiple paths breaks subprocess.call
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20894>
_______________________________________


More information about the Python-bugs-list mailing list