This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: COMSPEC with multiple paths breaks subprocess.call
Type: behavior Stage: resolved
Components: Windows Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: brian.curtin, elja, r.david.murray
Priority: normal Keywords:

Created on 2014-03-12 10:02 by elja, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg213234 - (view) Author: Elja van Tol (elja) Date: 2014-03-12 10:02
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 :) )
msg213261 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-03-12 14:36
This was a misconfiguration of your system.  It is not a bug in Python.  (Unless can find a microsoft reference that says that COMPSPEC can contain more than one path?  I don't think you will; see, eg: http://superuser.com/questions/446595/is-it-valid-for-comspec-to-have-multiple-entries)
msg213274 - (view) Author: Elja van Tol (elja) Date: 2014-03-12 18:17
I stand corrected, now i have to find out why my comspec was filled with nonsense. 
Sorry for the trouble!
History
Date User Action Args
2022-04-11 14:57:59adminsetgithub: 65093
2014-03-12 18:17:50eljasetmessages: + msg213274
2014-03-12 14:36:45r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg213261

resolution: not a bug
stage: resolved
2014-03-12 14:04:13yselivanovsetnosy: + brian.curtin
2014-03-12 10:02:25eljacreate