Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Tim Eberhard <xmin0s <at> gmail.com>
Subject: Re: What is correct import statement?
Newsgroups: gmane.comp.security.scapy.general
Date: Friday 9th January 2009 19:12:18 UTC (over 8 years ago)
I ran into this issue a while back..

Now at the top of my code I have a simple way to make the script work on
both versions.

try:from scapy.all import * #Required for Scapy 2.0 and above
except:from scapy import * #Scapy 1.0


Simply and easy. Just the way it should be and yes it will work correctly
with the scapy.all import * just fine.

Good luck,
-Tim Eberhard



On Fri, Jan 9, 2009 at 12:21 PM, Philippe Biondi  wrote:

> On Fri, 9 Jan 2009, Peter Steele wrote:
>
>  What is the correct import statement for scapy? I ask because I've seen
>> some sample code that uses
>>
>> from scapy import *
>>
>> but this doesn't seem to work for me. Take a look at this session:
>>
>> # python
>> Python 2.5.1 (r251:54863, Dec  7 2007, 20:09:03)
>> [GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>>> from scapy import *
>>>>> IP
>>>>>
>>>> Traceback (most recent call last):
>>  File "", line 1, in 
>> NameError: name 'IP' is not defined
>>
>>> from scapy.all import *
>>>>>
>>>> WARNING: No route found for IPv6 destination :: (no default route?)
>>
>>> IP
>>>>>
>>>> 
>>
>> So, when I use
>>
>> from scapy.all import *
>>
>> It seems to work, but I'm suspicious about this. Does anyone have an
>> explanation?
>>
>
> "from scapy import *" is before 2.x, "from scapy.all import *" is for 2.x
>
>
>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, send a mail to [email protected]
>>
>>
> [email protected]----
> To unsubscribe, send a mail to [email protected]
>
>
 
CD: 3ms