cannot get pexpect to work

Peter Hansen peter at engcorp.com
Fri Aug 29 23:37:42 CEST 2003


Andrei wrote:
> 
> > Unfortunately at this moment (13:45 EDT) I get no response to
> > connection requests on port 80.  (That is, server is answering
> > pings, but no web server on standard port.)
> 
> sorry, I had to bring the homeserver down because of a bad thunderstorm ...
> after which someone else must have taken the ip address=)
> 
> here it is on another server which is altogether more impervious to
> meteorogical changes ...
> 
> http://tufish.org/misc/passmass.py.txt

I note that pexpect.py appears to be using a default timeout of 30 seconds.
It's quite possible your hosts are taking longer than that to respond
with the password prompt.  I've seen that happen, among other reasons,
because of reverse name resolution delays.  Near as I can tell ssh
is broken and always does a reverse mapping attempt, even if told
explicitly not to (and the default is supposed to be not to, also!).
Temporarily removing /etc/resolv.conf on the host you're connecting
to can help troubleshoot this...

If you modify the code to catch the exception and print child.before 
you might see how much, if anything, was received from the host.

Best solution:  this is Python (!), so just start up an interactive
session and type the relevant commands yourself, based on what you
see in pexpect.py.  Not only will you solve the problem, but you'll
end up with a much better understanding of pexpect.py and the passmass.py
script as well.

-Peter




More information about the Python-list mailing list