2013-07-18 59 views
0

因此,我今天遇到一個問題scapy不承認我的進口。這不是一個版本的問題,因爲我嘗試了所有可能的Python版本和兩種:從scapy.all進口*pydev與scapy無法識別進口

這個問題實在是煩人所以任何幫助

從Scapy的進口*

將不勝感激。目前我使用python 2.5與2.2 scapy。

下面是代碼:

import logging 
from scapy.layers.inet6 import IP 
logging.getLogger("scapy.runtime").setLevel(logging.ERROR) 
from scapy.all import * 

i = IP() 

,這裏是錯誤消息:

Traceback (most recent call last): 
    File "C:\Users\Martinooos\Desktop\eclipse\plugins\org.python.pydev_2.7.5.2013052819\pysrc\pydev_runfiles.py", line 432, in __get_module_from_str 
    mod = __import__(modname) 
    File "C:\Users\Martinooos\workspace\testing\test.py", line 7, in <module> 
    from scapy.layers.inet6 import IP 
    File "C:\Users\Martinooos\Desktop\scapy-2.2.0\scapy\layers\inet6.py", line 35, in <module> 
    from scapy.layers.l2 import * 
    File "C:\Users\Martinooos\Desktop\scapy-2.2.0\scapy\layers\l2.py", line 14, in <module> 
    from scapy.ansmachine import * 
    File "C:\Users\Martinooos\Desktop\scapy-2.2.0\scapy\ansmachine.py", line 14, in <module> 
    from sendrecv import send,sendp,sniff 
    File "C:\Users\Martinooos\Desktop\scapy-2.2.0\scapy\sendrecv.py", line 13, in <module> 
    import arch 
    File "C:\Users\Martinooos\Desktop\scapy-2.2.0\scapy\arch\__init__.py", line 79, in <module> 
    from windows import * 
    File "C:\Users\Martinooos\Desktop\scapy-2.2.0\scapy\arch\windows\__init__.py", line 17, in <module> 
    from scapy.sendrecv import srp1 
ImportError: cannot import name srp1 

注:如果我從文件中刪除SRP1例如另一導入錯誤彈出所以這也同樣適用每一次進口。由於pydev識別scapy文件夾,我不知道發生了什麼。

任何人都可以幫助我嗎? 謝謝

+0

noone能回答嗎?:( – Martinos

+0

scapy命令是否獨立工作?當您從命令行運行並且您有交互式會話? – RyPeck

回答

0

務必確保訂單正確。下面的代碼工作正常。

import logging 
from scapy.all import * 
from scapy.layers.inet6 import IP 
logging.getLogger("scapy.runtime").setLevel(logging.ERROR) 

i = IP()