Pexpect and telnet not communicating properly

Mark Wooding mdw at
Tue Jan 27 21:37:03 CET 2009

David Anderson <lists at> writes:

> I am trying to automate the following session - to talk to my router:
> telnet speedtouch
> I am using the following code:
> child.expect('sername : ')
> child.sendline('Administrator')

I've scripted communications with my Speedtouch 510 using pexpect: I use
it to send the router's logs to my server.  The obvious difference
between my script and yours is that instead of sendline, I used send and
an explicit carriage return.

        kid.expect('Username :')

I think this is a result of a similar problem, but I don't remember any

Anyway, I've put my (very simple) script up at

in case you're interested.  (No, I wasn't daft enough to put the
password in the script!)

-- [mdw]

More information about the Python-list mailing list