subprocess error in python
Question: I am trying to run a praat file from python itself with subprocess but
python(subprocess) can't seem to find the directory. I don't understand why
since when I run the command in terminal, it works perfectly fine. Cant anyone
guide me to where I am going wrong? This is the subprocess code

    
    
    import silex
    import subprocess as sb
    cmd_line = raw_input()
    args = shlex.split(cmd_line)
    p = sb.Popen(args)
    

When I run it with the input

    
    
    Praat /Users/admirmonteiro/tmp/tmp.praat
    

this is the error that I get :

    
    
    Traceback (most recent call last):
      File "<input>", line 1, in <module>
      File "/Users/admirmonteiro/anaconda/lib/python2.7/subprocess.py", line 710, in __init__
        errread, errwrite)
      File "/Users/admirmonteiro/anaconda/lib/python2.7/subprocess.py", line 1335, in _execute_child
        raise child_exception
    OSError: [Errno 2] No such file or directory
    

As mentioned, I run the commands and they run fine in the terminal. I have
also tried to run subprocess.call but the same error occurs. I have also tried
with with shell=True as an argument but that also outputs the same error.
Please Help !


Answer: Type the following in the shell to get the full path of the
`Praat`application.

    
    
    whereis Praat
    

Then use the full path in you python program.

