在我们公司,我们出于某种原因使用 Jython。我需要用 ExpectJ 扩展它,但我不知道该怎么做。
我设法下载了expectj-2.0.7.jar、expectj-2.0.7-sources.jar和expectj-2.0.7-javadoc.jar文件,并使 Jython 和 Java 本身也可以访问它们。
所以我可以在我的 python 脚本中导入它,JVM 也可以找到 jars(通过使用类路径加载程序 hack)。但是根据ExpectJ 的文档,还是有问题。
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
方法?有人对此有解决方案吗?