On 01/15/2012 05:11 PM, Saqib Ali wrote: > > Very good question. Let me explain why I'm not opening me.txt directly > in python with open. > > The example I have posted is simplified for illustrative purpose. In > reality, I'm not doing pexpect.spawn("/bin/tcsh"). I'm doing > pexpect.spawn("ssh myuser@ipaddress"). Since I'm operating on a remote > system, I can't simply open the file in my own python context.
There is a very nice python module called "paramiko" that you could use to, from python, programatically ssh to the remote system and cat the file (bypassing any shells) or use sftp to access it. Either way you don't need to use pexpect with it. -- http://mail.python.org/mailman/listinfo/python-list