I am trying to get a Popen command running on Windows with a shell=False and for the life of me I can't get it working. iTMSTransporter is a command line application. This is my current code:
import os
import shlex
import subprocess
from subprocess import Popen, PIPE, STDOUT
link = "C:/progra~1/itms/iTMSTransporter"
link1 = os.path.normpath(link)
link2 = "C:/Temp/test1.itmsp"
link3 = os.path.normpath(link2)
link4 = os.path.join(link3, "LogFile.txt")
command = link1 + " -m verify -f " + link3 +" -u username -p password -o " + link4 + " -s provider -v eXtreme"
process = Popen(shlex.split(command), shell=False, stdin=PIPE)
Which gives me the error:
Traceback (most recent call last):
File "C:\Temp\temp.py", line 13, in <module>
process = Popen(shlex.split(command), shell=False, stdin=PIPE)
File "C:\Python27\lib\subprocess.py", line 709, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 957, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
I'm sure progra~1 is not the issue as this works with shell=True, and have also tried Program Files, same result. Any ideas to get this working on Windows platform, Python 2.7?