AF_INET error

Soundwave maybe at lucky.com
Tue Apr 11 19:39:45 CEST 2000


OK, sorry

here we go

On www.python.org is a HOWTO guide for creating sockets, i'll give an
example from what is said in the guide

This is the first example

import socket
#create an INET, STREAMing socket
s = socket.socket(
    socket.AF_INET, socket.SOCK_STREAM)
#now connect to the web server on port 80
# - the normal http port
s.connect("www.mcmillan-inc.com", 80)

when I run this code, I get the following output

Traceback (innermost last):
  File "C:\PROGRA~1\PYTHON\TOOLS\IDLE\ScriptBinding.py", line 131, in
run_module_event
    execfile(filename, mod.__dict__)
  File "C:/Program Files/Python/socket.py", line 3, in ?
    s = socket.socket(
AttributeError: AF_INET


maybe I look (maybe i even are ?) a bit stupid, but I realy don't know what
it means, or what I am doeing wrong.

Thanx by the way

Fredrik Lundh <effbot at telia.com> schreef in berichtnieuws
cHHI4.1202$Za1.20911 at newsc.telia.net...
> Soundwave <maybe at lucky.com> wrote:
> > I want to learne some things about socket programming, so I started the
> > socet programming tutorial on www.python.org
> >
> > but when I copy te code from some sample programm's and run it, it
doesn't
> > work, it don't recognize the AF_INET thing, is this because I am using
> > Windows ??
> >
> > can somebody please explain this to me ?
> >
> > Or what am I doeing wrong ?
>
> well, since you forgot to tell us what example you tried to
> run, how you typed it in, and what error you got, I can only
> guess.
>
> -- make sure to import the socket module
>
> -- make sure to use the "socket." prefix, so Python
>    knows where to look for the AF_INET "thing" (it's
>    a variable).
>
> </F>
>
>





More information about the Python-list mailing list