On 8 feb, 14:40, Chris Rebert <c...@rebertia.com> wrote: > On Tue, Feb 8, 2011 at 5:26 AM, gracemia gracemia <grace...@gmail.com> wrote: > > File "prueba.py", line 4, in <module> > > sock = socket(AF_UNIX, SOCK_STREAM) > > NameError: name 'AF_UNIX' is not defined > > > code: > > > import socket > > sock = socket(AF_UNIX, SOCK_STREAM) > > You need to qualify all those names. Normal `import` doesn't dump all > the importee's names into the importer's namespace; it only imports > the name of the module itself. Thus: > > import socket > sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) > > I would recommend (re-)reading the relevant part of the > tutorial:http://docs.python.org/tutorial/modules.html > > Cheers, > Chris > -- > I would also recommend bypassing the EggHeadCafe junk and instead > posting directly to the newsgroup/mailinglist.http://blog.rebertia.com
Sorry about my reply numbers, my browser blocked. Thank you very much. It works for me. -- http://mail.python.org/mailman/listinfo/python-list