New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SocketServer: server_address is... a socket #55339
Comments
Hello, I have issues with a script I'm programming (TypeError at every client connection), so I edited BaseServer's __init__():
def __init__(self, server_address, RequestHandlerClass):
"""Constructor. May be extended, do not override."""
if isinstance(server_address, socket._socketobject):
raise Exception()
self.server_address = server_address
self.RequestHandlerClass = RequestHandlerClass
self.__is_shut_down = threading.Event()
self.__shutdown_request = False
And it raises sometimes this traceback:
Exception happened during processing of request from ('127.0.0.1', 32810)
Traceback (most recent call last):
File "/usr/lib/python2.6/SocketServer.py", line 285, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 311, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 324, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.6/SocketServer.py", line 400, in __init__
BaseServer.__init__(self, server_address, RequestHandlerClass)
File "/usr/lib/python2.6/SocketServer.py", line 198, in __init__
raise Exception() Best regards, |
The problem happens on Python 2.7 too. Additionaly, here is the traceback, if I don't edit the library:
Exception happened during processing of request from ('127.0.0.1', 50378)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 408, in __init__
self.server_bind()
File "/usr/lib/python2.7/SocketServer.py", line 419, in server_bind
self.socket.bind(self.server_address)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
TypeError: getsockaddrarg: AF_INET address must be tuple, not _socketobject |
This seems odd to me: this line: |
Oooooh, excuse me, it's because of my code! class MyRequestHandler(SocketServer.TCPServer): |
Unable to determine the bug here. If you have questions with using python, please ask python-list@python.org |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: