0
有了pexpect,我產生了子進程並執行'ssh'遠程框。它從最近幾天開始工作得很好,突然現在我每當我嘗試產生子進程時它都拋出錯誤。不知道發生了什麼事。直到現在我使用pexpect 3.1,我遇到這個問題。所以我將它升級到3.2,但仍面臨同樣的問題。pexpect.EOF:文件結束(EOF)。異常風格的平臺
>>> 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
期望[pexpect.TIMEOUT,'[P | p] assword:'],但得到了pexpect.EOF。 – Sam