Message1073

Author nobody
Recipients
Date 2005-11-04.21:15:48
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
With Jython 2.1, I tried to run the send() method from
socket.py and got the error :    
   
   File "C:\jython\Lib\socket.py", line 304, in send
TypeError: sendto() takes at least 3 arguments (2 given)

Here is the method in socket.py with the problem shown
in the stacktrace:

   def send(self, data):
	assert self.addr
	return self.sendto(self.addr)      # line 304


The definition of self.sendto() is:

     def sendto(self, data, addr):
	n = len(data)
	if not self.sock:
	    self.sock = java.net.DatagramSocket()
	host, port = addr
	bytes = jarray.array(map(ord, data), 'b')
	a = java.net.InetAddress.getByName(host)
	packet = java.net.DatagramPacket(bytes, n, a, port)
	self.sock.send(packet)
	return n


It looks like there is a missing argument in the call
to self.sendto() that is in send().  If I edit send():

	return self.sendto(data, self.addr)   # line 304
	
it seems to fix the problem.
History
Date User Action Args
2008-02-20 17:17:26adminlinkissue1348645 messages
2008-02-20 17:17:26admincreate