s = socket.socket(socket.PF_PACKET,socket.SOCK_RAW,socket.ntohs(0x0800))AttributeError: module 'socket' has no attribute 'PF_PACKET'

Hello bro,plaese anyone help me,i dont understand why run this Error with module socket,i update my Pycharm at 2022 version,what s the problem?thx so much for all

4 comments
Comment actions Permalink

Hi, 

More info about the issue needed. Steps to reproduce and a code sample would help greatly.

0
Comment actions Permalink

hi bro thx for your answer i copy this my code and the output from pycharm ok let s go:

import socket
s= socket.socket(socket.PF_PACKET,socket.SOCK_RAW,socket.ntohs(0*800))
while True:
packet=s.recvfrom(65565)
print(packet)

C:\Users\baccioalex\PycharmProjects\pythonProject7\venv\Scripts\python.exe C:/Users/baccioalex/PycharmProjects/pythonProject7/main.py
Traceback (most recent call last):
  File "C:\Users\baccioalex\PycharmProjects\pythonProject7\main.py", line 2, in <module>
    s= socket.socket(socket.PF_PACKET,socket.SOCK_RAW,socket.ntohs(0*800))
AttributeError: module 'socket' has no attribute 'PF_PACKET'

Process finished with exit code 1

i don t understand bro the code is good but pycharm give this output 

thx much for your care

0
Comment actions Permalink

humm true bro,thx,i put this code in google page and now runs good,but sorry this coding  problem comes from where in your opinion?

0

Please sign in to leave a comment.