title: python cannot kill process using process.terminate
body: <p>I have a python code as following:</p>
  
  <pre><code>import threading
  import time
  import subprocess, os, sys, psutil, signal
  from signal import SIGKILL
  
  def processing():
      global p_2
      global subp_2
      .
      .
      .
      if condition1: #loop again
            threading.Timer(10,processing).start()
      if condition2:
            signal.signal(signal.SIGINT, signal_handler)
            #signal.signal(signal.SIGTERM, signal_handler)
            subp_2.terminate()   
            #os.kill(subp_2.pid, 0)
            #subp_2.kill()            
            print " Status p_2: ", p_2.status
  
  def signal_handler(signal, frame):
      print('Exiting')
      sys.exit(0)
  
  def function():
      global p_1
      global subp_1
      .
      .
      .
      if condition1: #loop again
            threading.Timer(5,function).start()
  
      if condition2:
  
            signal.signal(signal.SIGINT, signal_handler)
            #signal.signal(signal.SIGTERM, signal_handler)
            subp_1.terminate()   
            #os.kill(subp_1.pid, 0)
            #subp_1.kill()            
            print " Status p_1: ", p_1.status
            threading.Timer(10,processing).start()  
            subp_2 =  subprocess.Popen('./myScript2.sh %s %s' % (arg0, arg1), shell=True)
            p_2 = psutil.Process(subp_2.pid)
  
  if __name__ == '__main__':
            global p_1
            global subp_1 
            .
            .
            .
            subp_1 = subprocess.Popen(["/.../myScript1.sh"],  shell=True)
            p_1 = psutil.Process(subp_1.pid)
            threading.Timer(5,function).start()
  </code></pre>
  
  <p>I could not kill the processe subp_1 and subp_2. Whatever I tried: .terminate(), .kill() or os.kill() I am still getting process status running. Could anyone tell me please what am I missing ? Any hint is appreciated.</p>