Hey guys, I'm trying to get a socket to work, but this code doesn't seem to fire.

import sys
import os
import socket

serverHost = 'localhost'            # servername is localhost
serverPort = 2000                   # use arbitrary port > 1024

mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)    # create a TCP socket

The error is

File ".//socketTest.py", line 4, in <module>
import socket
File "/usr/lib/python2.5/socket.py", line 9, in <module>

AttributeError: 'module' object has no attribute 'AF_INET'

Any one shed any light to it?

Wow, that's weird.

>>> import socket
>>> socket.AF_INET

Can you reproduce my results?