Socket Error

kingofearth.com at gmail.com kingofearth.com at gmail.com
Thu Apr 14 14:38:23 EDT 2005


When I try to open a socket with python i get the following error:

Traceback (most recent call last):
  File "./mailer", line 3, in ?
    sock = socket.socket(socket.PF_INET, socket.SOCK_STREAM)
NameError: name 'socket' is not defined

the code is:

#!/usr/bin/python

sock = socket.socket(socket.PF_INET, socket.SOCK_STREAM)
sock.connect(("mail.oasd.k12.wi.us", 25))
sock.send("HELO")
print sock.recv(8192)
sock.close()




More information about the Python-list mailing list