Re: get the IP address of a host

2005-01-06 Thread J Berends
Lee Harr wrote: I found that the socket solutions only work if your DNS entries are correct ... which in my case was not true. So I came up with this: That is indeed correct, and even if the DNS entries are correct at times it does not give the full list of IPs by gethostbyname or gethostbyaddr.

sorting on keys in a list of dicts

2005-01-06 Thread J Berends
Suppose I have a list of dictionaries and each dict has a common keyname with a (sortable) value in it. How can I shuffle their position in the list in such way that they become sorted. Maybe I am doing it wrongly and you would say: why don't you get yourself a (slimmed-down) implementation of

Re: sorting on keys in a list of dicts

2005-01-06 Thread J Berends
Jp Calderone wrote: On Thu, 06 Jan 2005 15:31:22 +0100, J Berends <[EMAIL PROTECTED]> wrote: Suppose I have a list of dictionaries and each dict has a common keyname with a (sortable) value in it. How can I shuffle their position in the list in such way that they become sorted. In

Re: get the IP address of a host

2005-01-06 Thread J Berends
Jp Calderone wrote: On Thu, 06 Jan 2005 14:35:16 +0100, J Berends <[EMAIL PROTECTED]> wrote: From several approached I came up with the following code: def getipaddr(hostname='default'): """Given a hostname, perform a standard (forward) lookup and return

Re: 'Address already in use' when using socket

2005-04-08 Thread J Berends
Peter Hansen wrote: Bearish wrote: I get 'Address already in use' errors when using sockets. Generally one can fix this using: sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) where "sock" is the server socket in question. Do this prior to attempting to bind to the port. -Peter I agree