Problem with pexpect when executing a command on a remote machine

Kiran kumar Venkumahanti leo.cool001 at gmail.com
Wed Aug 27 11:27:39 EDT 2014


Hi,

I am trying to execute a command on a remote machine for which I am using
Python pexpect module. Iam able to connect and copy files to the remote
machine but getting the following error when trying to execute commands on
the remote machine. Please find the below error.


''Error sending command: cluster config -r -a Timeout exceeded in
read_nonblocking().\n<scp_ssh_lib.eSSH object at 0xa60cd0>\nversion: 2.4
($Revision: 516 $)\ncommand: /usr/bin/ssh\nargs: [\'/usr/bin/ssh\', \'-o\',
\'ServerAliveInterval=60\', \'-o\', \'UserKnownHostsFile=/dev/null\',
\'-o\', \'StrictHostKeyChecking=no\', \'root at 192.168.7.1\', \'-p\',
\'22\']\nsearcher: searcher_re:\n    0: re.compile("(:[^\\r\\n]*
#|[^\\r\\n]*] ->| [^\\r\\n]*][$#]|:[^\\r\\n]*[$#])")\nbuffer (last 100
chars):  \x1b[0;10mcluster config -r -a\r\nConfiguration is
OK!\r\nReloading configuration on all nodes\r\n\nbefore (last 100 chars):
 \x1b[0;10mcluster config -r -a\r\nConfiguration is OK!\r\nReloading
configuration on all nodes\r\n\nafter: <class
\'pexpect.pexpect.TIMEOUT\'>\nmatch: None\nmatch_index: None\nexitstatus:
None\nflag_eof: False\npid: 28817\nchild_fd: 7\nclosed: False\ntimeout:
10\ndelimiter: <class \'pexpect.pexpect.EOF\'>\nlogfile:
None\nlogfile_read: None\nlogfile_send: None\nmaxread: 2000\nignorecase:
False\nsearchwindowsize: None\ndelaybeforesend: 0.05\ndelayafterclose:
0.1\ndelayafterterminate: 0.1'

If we notice the error, the command is getting properly executed and the
output is also fetched but it returning a TIMEOUT error in
read_nonblocking() function of pxssh.py file of the pexpect module.

Please let me know how can I avoid this. Even the error is not consistent,
sometimes I am able to execute properly but it is failing most of the times.

Kindly reply me as soon as possible.

Thanks in advance.

Regards,
Kiran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140827/c94b6f4f/attachment.html>


More information about the Python-list mailing list