AF_INET error

Gordon McMillan gmcm at hypernet.com
Tue Apr 11 15:26:52 EDT 2000


Soundwave wrote:

> 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

It seems you have a module named socket.py which is being 
imported instead of the standard one (which would be 
Lib/socket.py).

- Gordon




More information about the Python-list mailing list