Author helduel
Recipients helduel
Date 2009-03-05.10:14:59
SpamBayes Score 0.00106536
Marked as misclassified No
Message-id <1236248103.61.0.911918415156.issue5421@psf.upfronthosting.co.za>
In-reply-to
Content
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))
History
Date User Action Args
2009-03-05 10:15:05helduelsetrecipients: + helduel
2009-03-05 10:15:03helduelsetmessageid: <1236248103.61.0.911918415156.issue5421@psf.upfronthosting.co.za>
2009-03-05 10:15:01helduellinkissue5421 messages
2009-03-05 10:15:00helduelcreate