Search code examples
pythonpython-2.7raspberry-piraspberry-pi3scapy

Python raises AttributeError when attempting to send ARP request on Raspberry Pi 3


I'm working on a program that automatically scans the local network using ARP requests on a Raspberry Pi 3. The code works fine on my computer, but when I try to run it on my Raspberry Pi, it fails with the following error:

File "/usr/local/lib/python2.7/dist-packages/scapy/base_classes.py", 
line 241, in __getattr__
    raise AttributeError(attr)
AttributeError: who_has

The code that raises this error is as follows:

from scapy import *

result, unanswered = sr(ARP(op=ARP.who_has, psrc="192.168.0.79", pdst="192.168.0.1"), timeout=3)

Solution

  • The error was caused because my RPi had a different version of scapy installed and, for some reason, it would not uninstall that version. After resetting my RPi completely and installing the correct version of scapy (2.3.3), the code now runs fine.

    Thank you Foon for pointing me in the right direction.