Problem while doing a cat on a tabbed file with pexpect

Michael Torrie torriem at gmail.com
Sun Jan 15 22:47:31 EST 2012


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 at 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.



More information about the Python-list mailing list