I am not very familiar with the computer software terminology (my apologies).
- I designed a GUI in Python that suppose to execute and/or terminate a script when an appropriate button (on the GUI) is pressed.
When I press a "Start" button (QPushButton) on the GUI, the following command executes the script filename.dut in the command prompt as follows:
subprocess.call ('launcher.exe localhost filename.dut', shell=True).I want to be able to terminate the script in a similar way, i.e., to press a "Stop" button on the GUI that will write into the command prompt an appropriate command to terminate the script. I think I can find the solution in this thread: Ending external programs with Python. The suggested solution is:
import subprocess taskname = '...' task = 'taskkill /im ' + taskname + ' /f' subprocess.check_call(task, shell=True)My quastion is how can I obtain the taskname ?
Any suggestions or alternate solution would be very appreciated.
subprocessmodule, but if you can get the process id, psutils looks like it might help.