From 4eb1afc2654252d3cbe1ae55d8f3c4ac885eec27 Mon Sep 17 00:00:00 2001 From: aroberts Date: Mon, 30 Jun 2014 15:02:40 -0500 Subject: [PATCH] Fix IndexError on Jython (#250) Jython has an unfortunate issue where the socketaddr object isn't really a tuple, but is instead an item that acts like a tuple under some circumstances. This commit makes httplib2 convert it to an actual tuple, so that it will work as expected. This solution isn't very nice, but without upstream fixes to Jython, this is the only obvious solution. --- python2/httplib2/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py index d1212b5..8c39647 100644 --- a/python2/httplib2/__init__.py +++ b/python2/httplib2/__init__.py @@ -898,7 +898,7 @@ def connect(self): if use_proxy: print "proxy: %s ************" % str((proxy_host, proxy_port, proxy_rdns, proxy_user, proxy_pass)) - self.sock.connect((self.host, self.port) + sa[2:]) + self.sock.connect((self.host, self.port) + tuple(sa)[2:]) except socket.error, msg: if self.debuglevel > 0: print "connect fail: (%s, %s)" % (self.host, self.port)