exiting a running command in python
Question: I'm new to python. I'm writing a script that calls a command line tool and
displays the output from the command on the screen. The issue is that after
the command runs it doesn't exit on it's own, it requires manual typing of
ctrl-c to stop and continue on with the rest of the python script. Does anyone
know how I could get it to stop on it's own and continue on with the rest of
the script?

    
    
    cmd ='./ppshelper -sms "15062929382" warning'
    os.system(cmd)
    print "SMS sent"
    

"SMS sent" is not printed until the user presses ctrl-c

Thanks


Answer: Use [`Popen`](http://docs.python.org/library/subprocess.html#popen-objects)

    
    
    from subprocess import Popen
    p = Popen(['/full/path/to/ppshelper', '-sms', '15062929382','warning'])
    p.terminate()
    

