Reputation: 25428
I am trying to run the following command from python:
C:\Program Files\Electric Cloud\ElectricCommander\bin\ectool --server server.domain.com login "username" "password"
The command is not invoked properly using the below code.
from subprocess import Popen, PIPE
toolLocation = "C:\\Program Files\\Electric Cloud\\ElectricCommander\\bin\\ectool"
parameters = "--server server.domain.com login \"username\" \"password\""
output = Popen([toolLocation, parameters ], stdout=PIPE)
print output.stdout.read()
Any idea why it failed?
Upvotes: 0
Views: 351
Reputation: 69082
You're passing only one paramerter, you need to pass every single parameter as element of a list, eg.:
from subprocess import Popen, PIPE
toolLocation = "C:\\Program Files\\Electric Cloud\\ElectricCommander\\bin\\ectool"
parameters = ["--server", "server.domain.com", "login", "username", "password"]
output = Popen([toolLocation] + parameters, stdout=PIPE)
print output.stdout.read()
Upvotes: 1