I kept getting this error:

AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH'

I tried to follow solutions from this stackoverflow question, however still getting the same error.

If I comment out everything else, and just execute:

import socket

It returns this, which looks good to me,

<module 'socket' from '/Users/raheyo/.pyenv/versions/3.9.18/lib/python3.9/socket.py'>

However, when I try printing the constants:


I get the same error again for “no attribute ‘AF_BLUETOOTH'”
Note that it doesn’t just happen for ‘AF_BLUETOOTH’, same thing happens for ‘AF_ASH’ and ‘AF_ALG’.

Please help!