A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-August/112940.html below:

[Python-Dev] Strange message error in socket.sendto() exception

[Python-Dev] Strange message error in socket.sendto() exceptionFacundo Batista facundobatista at gmail.com
Sat Aug 20 12:58:13 CEST 2011
Python 3.2 (r32:88445, Mar 25 2011, 19:28:28)
[GCC 4.5.2] on linux2
>>> import socket
>>> s = socket.socket()
>>> print(s.sendto.__doc__)
sendto(data[, flags], address) -> count
...
>>> s.sendto(b'data', ('localhost', 3))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.error: [Errno 32] Broken pipe

This is ok, I expected this. However, note what happens if I send unicode:

>>> s.sendto('data', ('localhost', 3))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: sendto() takes exactly 3 arguments (2 given)

An error regarding the argument quantity? what?

Furthermore, where this message comes from? I tried to find, but the
only hint I get is that it could come from
"./Modules/_ctypes/_ctypes.c"... are we using ctypes to access socket
methods? it's strange, because "sendto" is defined in socketmodule.c.

Ideas? Thanks!

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4