Brad Miller <[EMAIL PROTECTED]> added the comment:

I found a similar problem in the Demo/sockets/unixclient.py code.

from socket import *

FILE = 'unix-socket'
s = socket(AF_UNIX, SOCK_STREAM)
s.connect(FILE)
s.send('Hello, world')
data = s.recv(1024)
s.close()
print('Received', repr(data))

Produces the following error message:

Traceback (most recent call last):
  File "unixclient.py", line 9, in <module>
    s.send('Hello, world')
TypeError: send() argument 1 must be string or buffer, not str

My question is around whether the examples are wrong and 'Hello, World'
should simply be wrapped with bytearray('Hello, World','utf8')   or
whether the underlying socket implementation is wrong.  Judging by the
error message above it looks like the implementation is catching just
this kind of error and the example should be changed.  But, this must
break backward compatibility all over the place.  And since the bug has
release blocker it makes me think the socket implementation should be
changed.

----------
nosy: +bmiller

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4275>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to