Re: A little help with pexpect

2009-07-19 Thread Piet van Oostrum
> Piet van Oostrum (PvO) wrote: [snip] >PvO> You can also consider using paramiko instead of pexpect. [snip] > chan = t.open_session() > chan.exec_command('cat') > chan.send('abcdefghijklmn\n') In a real program it is better to use sendall here, as send may decide to send only pa

Re: A little help with pexpect

2009-07-19 Thread Piet van Oostrum
> Hussein B (HB) wrote: >HB> Hey, >HB> I'm trying to execute a command over a remore server using pexpect >HB> + >HB> url = 'ssh internalserver' >HB> res = pexpect.spawn(url) >HB> print '1' >HB> res.expect('.*ssword:') >HB> print '2' >HB> res.sendline('mypasswd') >HB> print '3

A little help with pexpect

2009-07-19 Thread Hussein B
Hey, I'm trying to execute a command over a remore server using pexpect + url = 'ssh internalserver' res = pexpect.spawn(url) print '1' res.expect('.*ssword:') print '2' res.sendline('mypasswd') print '3' res.sendline('ls -aslh') + What I want to do is to send a coup