From: SourceForge.net <no...@so...> - 2007-05-18 21:41:23
|
Bugs item #1348645, was opened at 2005-11-04 16:15 Message generated for change (Settings changed) made by cgroves You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1348645&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Library >Group: targeted for 2.2rc1 Status: Closed Resolution: Fixed Priority: 4 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: socket.py send() error? Initial Comment: 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. ---------------------------------------------------------------------- Comment By: Alan Kennedy (amak) Date: 2007-05-18 14:10 Message: Logged In: YES user_id=647684 Originator: NO This was indeed a bug; the send function could never have worked as it was. This is already fixed in 2.2b2. As for jython 2.1, the simple fix suggested above will work, i.e. change the send function to be defined as def send(self, data): assert self.addr return self.sendto(data, self.addr) ---------------------------------------------------------------------- Comment By: Frank Wierzbicki (fwierzbicki) Date: 2005-11-05 10:11 Message: Logged In: YES user_id=193969 Alan Kennedy is working on some updates to sockets from jython -- so hopefully this will get cleaned up in the 2.2 series. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1348645&group_id=12867 |