在我们公司,我们使用的Jython出于某种原因。我需要用ExpectJ扩展它,但我无法弄清楚如何去做。如何在Jython中使用ExpectJ?
我设法下载expectj-2.0.7.jar,expectj-2.0.7-sources.jar和expectj-2.0.7-javadoc.jar文件,使他们对Jython的访问, Java本身也是如此。
所以我可以在我的Python脚本导入和JVM也发现罐子(使用classpath loader hack)。但根据ExpectJ's docs,有些事情仍然是错误的。
import expectj
ex = expectj.ExpectJ() # I cannot use the second form of the
# constructor where I can pass a timeout
# parameter
sh = ex.spawn(targetshell, 22, usr, passw) # There is no spawn method in
# ExpectJ - but why???
这就是我陷入困境的地方。为什么ExpectJ对象没有spawn
方法?有没有人有这个解决方案?