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
print(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:

print(socket.AF_BLUETOOTH)

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!