python - Python Pexpect 期望得到超时错误
问题描述
期望函数超时。我正在发布我的代码以及手动完成的步骤
import pexpect
from pexpect import popen_spawn
child = popen_spawn.PopenSpawn('tibemsadmin -server localhost:7222 -user admin -password admin', cwd='C:/tibco/ems/8.5 - Copy/bin')
out = child.sendline('delete queue zzzzzzz')
child.expect('Are you sure (yes,no)?')
print(out)
手动完成时:
C:\tibco\ems\8.5 - Copy\bin>tibemsadmin -server localhost:7222 -user admin -password admin
TIBCO Enterprise Message Service Administration Tool.
Copyright 2003-2019 by TIBCO Software Inc.
All rights reserved.
Version 8.5.1 V4 9/12/2019
Connected to: tcp://localhost:7222
Type 'help' for commands help, 'exit' to exit:
tcp://localhost:7222> delete queue zzzzzzz
Are you sure (yes,no)? yes
Queue 'zzzzzzz' has been deleted
tcp://localhost:7222>
错误:
File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pexpect\expect.py", line 144, in timeout
raise exc
pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0x019AE790>
searcher: searcher_re:
0: re.compile(b'Are you sure (yes,no)?')
<pexpect.popen_spawn.PopenSpawn object at 0x019AE790>
searcher: searcher_re:
0: re.compile(b'Are you sure (yes,no)?')
解决方案
推荐阅读
- chronicle-map - ClassCastException 使用 ByteBuffer 作为 ChronicleMap 的键
- jquery - 表达式语言代码显示为纯文本 JSP
- function - return_of_invalid_type 返回类型“String”不是“void”,由方法“getData”定义
- python - 即使在更新数据库后,SQLAlchemy 也不会在我的表中找到该列?
- angular - 由于 Firebase 的 IDBIndex 错误,无法提供服务器呈现的应用程序
- java - 如何将 Swing 小部件插入 SWT 我在使用 SWT_AWT.new_Frame 时在线程“main”java.lang.IllegalArgumentException 中出现异常
- angular - Ngrx,Rxjs - 合并可观察的流返回一个新的流
- angular - 子节点出现在每个父节点中
- php - 如何为已在 phpunit 中初始化的 MockObject 实例设置动态属性
- angular - 在 Angular 后端的每个服务上出现 403 错误是在 laravel