issue while doing pexpect ssh

Laura Creighton lac at openend.se
Tue Sep 8 08:12:27 EDT 2015


In a message of Tue, 08 Sep 2015 04:37:09 -0700, harirammanohar159 at gmail.com wr
ites:
>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...
>-- 
>https://mail.python.org/mailman/listinfo/python-list

https://pexpect.readthedocs.org/en/latest/api/pexpect.html#run-function
you want to use spawnu because you have a unicode string.

Laura



More information about the Python-list mailing list