I am trying to kill a subprocess via its pid by using subprocess.call() to do it. I obtain the pid by assigning return to a value like this:
return = subprocess.Popen(["sudo", "scrolling-text-example", "-y7"])
x= return.pid
When when I am ready to end this subprocess I am using this code:
subprocess.call(["sudo","kill",str(x)])
This does not kill the subprocess, but if I open terminal (let's say x is 1234), and type: sudo kill 1234
, it will kill the subprocess.