On OSX, I've seen both:
Exception in thread Thread-2:
Traceback (most recent call last):
File "/Users/jyasskin/src/python/test_asyncore/Lib/threading.py", line 464, in __bootstrap
self.run()
File "/Users/jyasskin/src/python/test_asyncore/Lib/threading.py", line 444, in run
self.__target(*self.__args, **self.__kwargs)
File "Lib/test/test_asyncore.py", line 59, in capture_server
serv.bind(("", PORT))
File "<string>", line 1, in bind
socket.error: (48, 'Address already in use')
after which the interpreter freezes, and
======================================================================
ERROR: test_send (__main__.DispatcherWithSendTests_UsePoll)
----------------------------------------------------------------------
Traceback (most recent call last):
File "Lib/test/test_asyncore.py", line 351, in test_send
d.send(data)
File "/Users/jyasskin/src/python/test_asyncore/Lib/asyncore.py", line 467, in send
self.initiate_send()
File "/Users/jyasskin/src/python/test_asyncore/Lib/asyncore.py", line 454, in initiate_send
num_sent = dispatcher.send(self, self.out_buffer[:512])
File "/Users/jyasskin/src/python/test_asyncore/Lib/asyncore.py", line 334, in send
if why[0] == EWOULDBLOCK:
TypeError: 'error' object is unindexable
I plan to fix the first by binding to port 0 as kuran suggested and using .getsockname()[1] to retrieve the port number, and the second by figuring out the right way to get the errno out of a socket.error.
|