Send input to program opened with subprocess using python?
Question: I have the following python code and just want to send a command to the
terminal when it asks a particular question. Here is what I have so far

    
    
    import subprocess
    import sys
    cmd = "Some application"
    dat = str("")
    
    p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, 
                         stdin=subprocess.PIPE, stdout=subprocess.PIPE)
    


Answer: 
    p.communicate(input="this is my input to the subprocess")
    

If you need to trap the output, do this instead:

    
    
    output = p.communicate(input="this is my input to the subprocess")[0]
    

