New submission from Manuel Hermann <manuel-herm...@gmx.net>: When sending unexpected data via a socket's sentdo method, a TypeError is raised with the fallowing message: "sendto() takes exactly 3 arguments (2 given)". But two arguments are sufficient.
Examples for Python 2.x: import socket my_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # this will succeed my_socket.sendto("Foobar", ("localhost", 514)) # these will fail with above error message my_socket.sendto(u"Umlaut รค", ("localhost", 514)) my_socket.sendto(1, ("localhost", 514)) Examples for Python 3: import socket my_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # this will succeed my_socket.sendto("No Umlaut".encode("ascii"), ("localhost", 514)) # these will fail with above error message my_socket.sendto("No Umlaut", ("localhost", 514)) my_socket.sendto(1, ("localhost", 514)) ---------- components: Library (Lib) messages: 83187 nosy: helduel severity: normal status: open title: Irritating error message by socket's sendto method versions: Python 2.4, Python 2.5, Python 2.6, Python 3.0 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5421> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com