Skip to content Skip to sidebar Skip to footer

Creating A Socket In Python

import socket import sys HOST = '' # Symbolic name meaning all available interfaces PORT = 8888 # Arbitrary non-privileged port s = socket.socket(socket.AF_INET, socket.SOCK_ST

Solution 1:

You called your file socket.py rename it to somethng like my_socket.py and delete the socket.pyc file in the same directory.

You are trying to import from your socket.py file not the actual socket module, python checks the local directory first.

Solution 2:

The error simply means that the socket object does not have an error field or attribute

I think it is a naming issue you have since you names your file as the name of socket module. Change the name, might fix the problem.

Post a Comment for "Creating A Socket In Python"