我在jython下导入scapy时遇到了一些问题.我一直在做java,但python只用了一两天.
重现问题的简单案例是:
$jython
>>> import sys
>>> sys.path
['', '/usr/share/jython/Lib', '/usr/lib/site-python', '__classpath__']
>>> from scapy.all import *
Traceback (innermost last):
File "<console>", line 1, in ?
ImportError: no module named scapy
Run Code Online (Sandbox Code Playgroud)
如果我完成这些完全相同的步骤python,一切正常.我怎么告诉jython使用scapy?如果它有帮助,我正在运行ubuntu 10.04并安装了jython和scapy viaapt-get install
我正在通过ScalaInAction工作(书籍仍然是MEAP,但代码在github上是公开的)现在我正在第2章中查看这个restClient :: https://github.com/nraychaudhuri/scalainaction/blob/master/ chap02/RestClient.scala
首先,我使用scala扩展设置了intelliJ并创建了一个HelloWorld main():
<ALL the imports>
object HelloWorld {
def main(args: Array[String]) {
<ALL the rest code from RestClient.scala>
}
}
Run Code Online (Sandbox Code Playgroud)
编译时出现以下错误:
scala: forward reference extends over defintion of value command
val httppost = new HttpPost(url)
^
Run Code Online (Sandbox Code Playgroud)
我可以通过移动以下几行来解决这个问题,直到有关defs 的顺序正确
require( args.size >= 2, "You need at least two arguments to make a get, post, or delete request")
val command = args.head
val params = parseArgs(args)
val url = args.last
command match {
case "post" …Run Code Online (Sandbox Code Playgroud)