I am on mac (first time) and using pycharm and visual code.
On pycharm, I am using a venv, have installed scapy and can see it is installed in the interpreter package manager and there is no red line under "import scapy". the issue arises when I try and import anything from that package "from scapy import UDP" or use anything in scapy "scapy.UDP". ----respective errors shown below.
ImportError: cannot import name 'UDP' from 'scapy' (/Users/{KEVIN}/PycharmProjects/UDP/venv/lib/python3.9/site-packages/scapy/__init__.py)
AttributeError: module 'scapy' has no attribute 'UDP'
As a side not I tried using visual code and system python, and the code runs with no issues, but i cant right click on UDP() and jump to the class definition it says not definition found? I feel like this has to be a mac related issue but i can't seem to figure it out.
UDP is not directly under scapy, you need to do
from scapy.layers.inet import UDP
then you can right click on UDP() and jump to the class definition.
Following two imports worked for me as well :
venv$ python
Python 3.8.10 (default, Sep 28 2021, 16:10:42)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from scapy.ansmachine import AnsweringMachine
>>> from scapy.all import UDP
>>>
Please double check you scapy installation.