Skip to content Skip to sidebar Skip to footer

Pexpect And Sending An "enter Key" Issues

I am using pexpect with python 2.7. I am currently writing a script to login to a jump server and then subsequently login to some cisco devices to perform some operations in an aut

Solution 1:

.sendline() is equivalent to .sendline('') that is equivalent to .send('') + .send(self.linesep) that is likely has the same effect as .send('\n') ('\n' == '\012', '\r' == '\015'). You could also try .send('\r\n') (I'm not sure who is responsible for the terminal line discipline).

Solution 2:

sendline() should be work. You can refer to the implementation of pxssh in pexpect. https://github.com/pexpect/pexpect/blob/master/pexpect/pxssh.py

Post a Comment for "Pexpect And Sending An "enter Key" Issues"