2

I'm trying to call a windows-cmd-file by python's subprocess.Popen module. This script then calls a powershell file that contains the problem logic. The call works fine and the script is executed, anyway it does not seem to terminate. Logic My current code is the following:

pRun = subprocess.Popen([r'C:\runps.cmd', 'C:\psfile.ps1', 'arg2'], shell=False) 
pRun.wait()
... rest of code

So far I am not interested in interaction with the script (like stdin or stdout), I just want to call the script and know when it is terminated.

When I call the same command (C:\runpw.cmd C:\psfile.ps1 arg2) from the windows command line it works fine, doing all the desired actions and then terminates s.t. I can input the next command. That's why I assume that python might wait forever for the termination of a process or thread, that just won't terminate.

Thanks for your help in advance!

post edit: The code will be executed on a windows machine

schneiti
  • 428
  • 1
  • 8
  • 22
  • http://stackoverflow.com/questions/4789837/how-to-terminate-a-python-subprocess-launched-with-shell-true may help. – boardrider May 08 '15 at 10:43

0 Answers0