37,719
社区成员
发帖
与我相关
我的任务
分享
import pexpect
child = pexpect.spawn('telnet 61.XXX.52.210')
child.expect('Username:')
child.sendline('zte')
……
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
child.expect('Username:')
File "/usr/lib/python2.6/site-packages/pexpect.py", line 1311, in expect
return self.expect_list(compiled_pattern_list, timeout, searchwindowsize)
File "/usr/lib/python2.6/site-packages/pexpect.py", line 1325, in expect_list
return self.expect_loop(searcher_re(pattern_list), timeout, searchwindowsize)
File "/usr/lib/python2.6/site-packages/pexpect.py", line 1396, in expect_loop
raise EOF (str(e) + '\n' + str(self))
EOF: End Of File (EOF) in read_nonblocking(). Empty string style platform.
<pexpect.spawn object at 0x7fb964cc>
version: 2.3 ($Revision: 399 $)
command: /cygdrive/c/WINDOWS/system32/telnet
args: ['/cygdrive/c/WINDOWS/system32/telnet', '61.XXX.52.210']
searcher: searcher_re:
0: re.compile("Username:")
buffer (last 100 chars):
before (last 100 chars):
after: <class 'pexpect.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 2044
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