With pexpect I am spawning child process and doing 'ssh' remote box. It was working fine from last many days, suddenly now i whenever i am trying to spawn child process it's throwing below Error. not sure what is going on.
Till now i was using pexpect 3.1, i encounter this problem. so I upgrade it to 3.2, but still facing same issue.
>>> child = pexpect.spawn('ssh -o StrictHostKeyChecking=no [email protected]')
>>> child.expect([pexpect.TIMEOUT,'[P|p]assword: '])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 1418, in expect
timeout, searchwindowsize)
File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 1433, in expect_list
timeout, searchwindowsize)
File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 1521, in expect_loop
raise EOF(str(err) + '\n' + str(self))
pexpect.EOF: End Of File (EOF). Exception style platform.
<pexpect.spawn object at 0x7fe923a8b710>
version: 3.2
command: /usr/bin/ssh
args: ['/usr/bin/ssh', '-o', 'StrictHostKeyChecking=no', '[email protected]']
searcher: <pexpect.searcher_re object at 0x7fe923a8b750>
buffer (last 100 chars): ''
before (last 100 chars): 'AL PROSECUTION.\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive).\r\r\n'
after: <class 'pexpect.EOF'>
match: None
match_index: None
exitstatus: 255
flag_eof: True
pid: 2202
child_fd: 3
closed: False
timeout: 30
delimiter: <class 'pexpect.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
child.expect([pexpect.TIMEOUT, 'pattern', pexpect.EOF])
Some UNIX platforms will throw an exception when you try to read from a file descriptor in the EOF state. Other UNIX platforms instead quietly return an empty string to indicate that the EOF state has been reached.
If you wish to read up to the end of the child’s output without generating an EOF exception then use theexpect(pexpect.EOF)method.
For the details, you can follow this.
Hope it will helpful to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With