socket data sending problem

Irmen de Jong irmen.NOSPAM at xs4all.nl
Wed Jul 3 18:57:34 EDT 2013


On 4-7-2013 0:38, ollietempleman at aol.com wrote:

> it all works fine, except for when i try to use:
> 
>   s.send("hello")
> 
> to send data between the client and server, i just get this error message:
> 
>   >>> 
>   Traceback (most recent call last):
>     File "C:/Users/Ollie/Documents/code/chatroom/client3.py", line 9, in <module>
>       s.send("hello")
>   TypeError: 'str' does not support the buffer interface
>   >>> 

Are you using Python 3.x? Try sending bytes instead of strings:

 s.send(b"hello")

Or switch to using Python 2.7

Irmen




More information about the Python-list mailing list