[newbie] trying socket as a replacement for nc

Ervin Hegedüs airween at gmail.com
Mon Dec 16 05:04:22 EST 2013


hello,

> #!/usr/bin/env python
> 
> """
> A simple echo client
> """
> import socket as socket_mod
> import bufsock as bufsock_mod
[...]
> Traceback (most recent call last):
>   File "./buftest.py", line 11, in <module>
>     socket = socket_mod.socket(socket.AF_INET, socket.SOCK_STREAM)
> NameError: name 'socket' is not defined

you should replace the socket.AF_INET to socket_mod.AF_INET, and
socket.SOCK_STREAM to socket_mod.SOCK_STREAM, if you've imported
socket modul as socket_mod. But this is just an idea... :)


a.



More information about the Python-list mailing list