Diez B. Roggisch wrote: >>This is the code section of my server class (I cut this from a Python >>example): >> def establishConnection(self): >> self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >> self.socket.connect((self.host, self.port)) >>Do I have to use explicit typecasting? How can this be achieved? > > > There is no such thing as explicit casting in python. You can coerce > values to values of another type - e.g. float("1.0"), and there are some > "magic" methods to support that (for that example __float__) > > However, that doesn't seem to be your problem. You just pass the wrong > arguments, which makes the jython wrapping punke on you as only certain > types can be dealt with. > > To me this looks as if you are supposed to do it like this: > > self.socket.connect(self.host, self.port) > > Note the missing parentheses. > """connect(address) Connect to a remote socket at address. (The format of address depends on the address family -- see above.) Note: This method has historically accepted a pair of parameters for AF_INET addresses instead of only a tuple. This was never intentional and is no longer available in Python 2.0 and later. """
So if Jython 2.1 is conformant it should indeed require a single argument which is an (IPAddress, port) tuple. It might be that the OP can't, for some reason associate with the local environment, resolve "localhost" to an IP address. What happens if "127.0.0.1" is substituted? Irrespective of that, it does seem that the error message is at best misleading and at most just plain wrong. There's aproject to bring Jython up to a more recent specification, but it will take time ... regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list