Question: I'm trying to use subprocess to read a file stored in a remote server.

```
import subprocess
import sys

ssh = subprocess.Popen(['ssh', 'hjh:passwd@myserver', 'cat', 'data/test.txt'],
                   shell=False,
                   stdout=subprocess.PIPE,
                   stderr=subprocess.PIPE)
result = ssh.stdout.readlines()
if result == []:
    error = ssh.stderr.readlines()
    print >>sys.stderr, "ERROR: %s" % error
else:
    print result

```

Now running this results in the error 

```
Traceback (most recent call last):
  File "C:/Users/hjh/Desktop/try.py", line 15, in <module>
stderr=subprocess.PIPE)
  File "C:\Python27\lib\subprocess.py", line 710, in __init__
errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

```

Does this error mean that the file on the server cannot be found? or is there an error in subprocess? Google wasn't much of a help for me on this error.

I also work with a Proxy which is not specified here, can that be a problem?

Cheers,

Answer: 
I suppose that Windows is unable to find the SSH executable. Check what happens when you type `ssh` in the `cmd.exe`. Try adding a full path to the SSH client executable in the Popen call or add SSH's directory to the PATH environment variable.
It seems like "ssh" cannot be resolved. I would either fully qualify the location to the ssh executable in the Popen constructor call and/or it is in the searchable PATH.