Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77139

Problem with pexpect when executing a command on a remote machine

Date 2014-08-27 20:57 +0530
Subject Problem with pexpect when executing a command on a remote machine
From Kiran kumar Venkumahanti <leo.cool001@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.13512.1409153261.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Problem with pexpect when executing a command on a remote machine Kiran kumar Venkumahanti <leo.cool001@gmail.com> - 2014-08-27 20:57 +0530

csiph-web