issue while doing pexpect ssh

harirammanohar159 at gmail.com harirammanohar159 at gmail.com
Wed Sep 9 13:22:52 CEST 2015


On Tuesday, 8 September 2015 17:07:24 UTC+5:30, hariramm... at gmail.com  wrote:
> Some where i am missing simple logic.... :)
> 
> =====
> child = pexpect.spawn('ssh hari at hostname')
> child.logfile = sys.stdout
> child.expect('hari\'s Password: ')
> =====
> 
> getting error as follows:
> ============
> child.expect('hari\'s Password: ')
> TypeError: must be str, not bytes
> ===========
> 
> Thanks...

Hi Laura,

Basically its the same, no difference if i keep su user1...
i am getting the desired output with a single host, but if i keep for loop for multiple hosts, remaining are skipped saying as below:

pexpect.TIMEOUT: Timeout exceeded.

During handling of the above exception, another exception occurred:

pexpect.TIMEOUT: Timeout exceeded.
<pexpect.pxssh.pxssh object at 0x7f22d2b838d0>

only 1st host is getting executed. how to control child.logout() and make for loop continue...


More information about the Python-list mailing list