New submission from Michael Newman <michael.b.new...@gmail.com>: Following the example in Section 20.23.5. ProtocolError Objects of: http://docs.python.org/3.1/library/xmlrpc.client.html It implies that an invalid URL will give raise an xmlrpc.client.ProtocolError. Instead I'm getting a socket.gaierror instead. (I also tried using the google address to show tat ProtocolError is working correctly if a real URL is used, but doesn't offer XML-RPC services.) This similarly is happening for xmlrpclib on Python 2.6.
Is this a bug or documentation mistake? Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import xmlrpc.client >>> proxy = xmlrpc.client.ServerProxy("http://invalidaddress/") >>> proxy.some_method() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\python31\lib\xmlrpc\client.py", line 1029, in __call__ return self.__send(self.__name, args) File "C:\python31\lib\xmlrpc\client.py", line 1271, in __request verbose=self.__verbose File "C:\python31\lib\xmlrpc\client.py", line 1058, in request http_conn = self.send_request(host, handler, request_body, verbose) File "C:\python31\lib\xmlrpc\client.py", line 1144, in send_request connection.request("POST", handler, request_body, headers) File "C:\python31\lib\http\client.py", line 918, in request self._send_request(method, url, body, headers) File "C:\python31\lib\http\client.py", line 956, in _send_request self.endheaders(body) File "C:\python31\lib\http\client.py", line 914, in endheaders self._send_output(message_body) File "C:\python31\lib\http\client.py", line 768, in _send_output self.send(msg) File "C:\python31\lib\http\client.py", line 716, in send self.connect() File "C:\python31\lib\http\client.py", line 698, in connect self.timeout) File "C:\python31\lib\socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 11001] getaddrinfo failed >>> proxy = xmlrpc.client.ServerProxy("http://www.google.com/") >>> proxy.some_method() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\python31\lib\xmlrpc\client.py", line 1029, in __call__ return self.__send(self.__name, args) File "C:\python31\lib\xmlrpc\client.py", line 1271, in __request verbose=self.__verbose File "C:\python31\lib\xmlrpc\client.py", line 1065, in request dict(resp.getheaders()) xmlrpc.client.ProtocolError: <ProtocolError for www.google.com/: 405 Method Not Allowed> >>> Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import xmlrpclib >>> proxy = xmlrpclib.ServerProxy("http://invalidaddress/") >>> proxy.some_method() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\python26\lib\xmlrpclib.py", line 1199, in __call__ return self.__send(self.__name, args) File "C:\python26\lib\xmlrpclib.py", line 1489, in __request verbose=self.__verbose File "C:\python26\lib\xmlrpclib.py", line 1235, in request self.send_content(h, request_body) File "C:\python26\lib\xmlrpclib.py", line 1349, in send_content connection.endheaders() File "C:\python26\lib\httplib.py", line 892, in endheaders self._send_output() File "C:\python26\lib\httplib.py", line 764, in _send_output self.send(msg) File "C:\python26\lib\httplib.py", line 723, in send self.connect() File "C:\python26\lib\httplib.py", line 704, in connect self.timeout) File "C:\python26\lib\socket.py", line 500, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 11001] getaddrinfo failed >>> proxy = xmlrpclib.ServerProxy("http://www.google.com/") >>> proxy.some_method() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\python26\lib\xmlrpclib.py", line 1199, in __call__ return self.__send(self.__name, args) File "C:\python26\lib\xmlrpclib.py", line 1489, in __request verbose=self.__verbose File "C:\python26\lib\xmlrpclib.py", line 1243, in request headers xmlrpclib.ProtocolError: <ProtocolError for www.google.com/: 405 Method Not Allowed> I also checked Python 3.1 on Linux: Python 3.1.1 (r311:74480, Oct 18 2009, 19:21:53) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import xmlrpc.client >>> proxy = xmlrpc.client.ServerProxy("http://invalidaddress/") >>> proxy.some_method() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1029, in __call__ return self.__send(self.__name, args) File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1271, in __request verbose=self.__verbose File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1058, in request http_conn = self.send_request(host, handler, request_body, verbose) File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1144, in send_request connection.request("POST", handler, request_body, headers) File "/usr/local/lib/python3.1/http/client.py", line 918, in request self._send_request(method, url, body, headers) File "/usr/local/lib/python3.1/http/client.py", line 956, in _send_request self.endheaders(body) File "/usr/local/lib/python3.1/http/client.py", line 914, in endheaders self._send_output(message_body) File "/usr/local/lib/python3.1/http/client.py", line 768, in _send_output self.send(msg) File "/usr/local/lib/python3.1/http/client.py", line 716, in send self.connect() File "/usr/local/lib/python3.1/http/client.py", line 698, in connect self.timeout) File "/usr/local/lib/python3.1/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno -2] Name or service not known >>> proxy = xmlrpc.client.ServerProxy("http://www.google.com/") >>> proxy.some_method() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1029, in __call__ return self.__send(self.__name, args) File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1271, in __request verbose=self.__verbose File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1065, in request dict(resp.getheaders()) xmlrpc.client.ProtocolError: <ProtocolError for www.google.com/: 405 Method Not Allowed> ---------- assignee: georg.brandl components: Documentation, Library (Lib) messages: 98493 nosy: georg.brandl, mnewman severity: normal status: open title: socket.gaierror before ProtocolError for xmlrpc.client type: behavior versions: Python 2.6, Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7802> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com