0

I tried do build a program that pings a website and print the answer. I expected that it'll ping google.com, but instead in the 1st line I get Attribute Error.

Traceback (most recent call last):
  File "d:\Magshimim\Networks Programming\Lesson 06\Homework\Solution\code.py", line 1, in <module>
    from scapy.all import *
  File "C:\Python38\lib\site-packages\scapy\all.py", line 35, in <module>
    from scapy.autorun import *
  File "C:\Python38\lib\site-packages\scapy\autorun.py", line 29, in <module>
    class ScapyAutorunInterpreter(code.InteractiveInterpreter):
AttributeError: module 'code' has no attribute 'InteractiveInterpreter'

So far, I tried to import the scapy module using: from scapy.all import *, import scapy and from scapy import *

My code:

from scapy.all import *
fullmsg = Ether() / IP(dst='google.com') / ICMP()
ans = srp1(fullmsg, verbose=0)
print(ans.show())
  • Can you post the full error? What OS are you using? If you use a virtualenv, do you see the same error? – Ross Jacobs May 13 '21 at 15:38
  • Maybe the cause is the name of your module. Try this [answer](https://stackoverflow.com/questions/7880827/werkzeug-attributeerror-module-object-has-no-attribute-interactiveinterprete) – Ohad Samuha May 13 '21 at 15:40
  • @RossJacobs - I use windows. I don't exactly know what is it virtualenv. – Ophir Botzer May 13 '21 at 16:26
  • Just rename your file. `code.py` is a poor name anyways, since any Python script will contain code. Rename it to `google_ping.py` or something. – Carcigenicate May 13 '21 at 19:13

0 Answers0