Issue 22235: httplib: TypeError with file() object in ssl.py (original) (raw)

Trying to push to a ssl server but python break in httplib.

erob@nguns:~/django-hotsauce$ hg push https://tkadm30@bitbucket.org/tkadm30/django-hotsauce pushing to https://tkadm30@bitbucket.org/tkadm30/django-hotsauce warning: bitbucket.org certificate with fingerprint 45:ad:ae:1a:cf:0e:73:47:06:07:e0:88:f5:cc:10:e5:fa:1c:f7:99 not verified (check hostfingerprints or web.cacerts config setting) ** unknown exception encountered, please report by visiting ** http://mercurial.selenic.com/wiki/BugTracker ** Python 2.7.3 (default, Aug 20 2014, 09:34:08) [GCC 4.7.2] ** Mercurial Distributed SCM (version 3.1) ** Extensions loaded: color, gpg, strip, mq, notify, patchbomb Traceback (most recent call last): File "/usr/local/bin/hg", line 43, in mercurial.dispatch.run() File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 28, in run sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 69, in dispatch ret = _runcatch(req) File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 138, in _runcatch return _dispatch(req) File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 820, in _dispatch cmdpats, cmdoptions) File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 600, in runcommand ret = runcommand(ui, options, cmd, d) File "/usr/local/lib/python2.7/site-packages/mercurial/extensions.py", line 196, in wrap return wrapper(origfn, *args, **kwargs) File "/usr/local/lib/python2.7/site-packages/hgext/color.py", line 433, in colorcmd return orig(ui, opts, cmd, cmdfunc) File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 911, in _runcommand return checkargs() File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 882, in checkargs return cmdfunc() File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 817, in d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) File "/usr/local/lib/python2.7/site-packages/mercurial/util.py", line 550, in check return func(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/mercurial/extensions.py", line 151, in wrap util.checksignature(origfn), *args, **kwargs) File "/usr/local/lib/python2.7/site-packages/mercurial/util.py", line 550, in check return func(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/hgext/mq.py", line 3393, in mqcommand return orig(ui, repo, *args, **kwargs) File "/usr/local/lib/python2.7/site-packages/mercurial/util.py", line 550, in check return func(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/mercurial/commands.py", line 4768, in push other = hg.peer(repo, opts, dest) File "/usr/local/lib/python2.7/site-packages/mercurial/hg.py", line 129, in peer return _peerorrepo(rui, path, create).peer() File "/usr/local/lib/python2.7/site-packages/mercurial/hg.py", line 106, in _peerorrepo obj = _peerlookup(path).instance(ui, path, create) File "/usr/local/lib/python2.7/site-packages/mercurial/httppeer.py", line 261, in instance inst._fetchcaps() File "/usr/local/lib/python2.7/site-packages/mercurial/httppeer.py", line 58, in _fetchcaps self.caps = set(self._call('capabilities').split()) File "/usr/local/lib/python2.7/site-packages/mercurial/httppeer.py", line 172, in _call fp = self._callstream(cmd, **args) File "/usr/local/lib/python2.7/site-packages/mercurial/httppeer.py", line 119, in _callstream resp = self.urlopener.open(req) File "/usr/local/lib/python2.7/urllib2.py", line 400, in open response = self._open(req, data) File "/usr/local/lib/python2.7/urllib2.py", line 418, in _open '_open', req) File "/usr/local/lib/python2.7/urllib2.py", line 378, in _call_chain result = func(*args) File "/usr/local/lib/python2.7/site-packages/mercurial/url.py", line 371, in https_open return self.do_open(self._makeconnection, req) File "/usr/local/lib/python2.7/site-packages/mercurial/keepalive.py", line 255, in do_open r = h.getresponse() File "/usr/local/lib/python2.7/site-packages/mercurial/keepalive.py", line 577, in safegetresponse return cls.getresponse(self) File "/usr/local/lib/python2.7/httplib.py", line 1028, in getresponse response = self.response_class(*args, **kwds) File "/usr/local/lib/python2.7/site-packages/mercurial/keepalive.py", line 380, in init httplib.HTTPResponse.init(self, sock, debuglevel, method) File "/usr/local/lib/python2.7/httplib.py", line 346, in init self.fp = sock.makefile('rb', 0) File "/usr/local/lib/python2.7/ssl.py", line 366, in makefile return _fileobject(self, mode, bufsize, close=True) TypeError: file() takes at most 3 arguments (4 given)

sometimes urllib break at different packages, with "SSL: CERTIFICATE_VERIFY_FAILED" message. It seem related to the new ssl.py backport and pip.

sudo python setup.py install --prefix=/usr/local Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.10.tar.gz Traceback (most recent call last): File "setup.py", line 31, in distribute_setup.use_setuptools() File "/home/steiner/Desktop/feedcache-1.4.1/distribute_setup.py", line 145, in use_setuptools return _do_download(version, download_base, to_dir, download_delay) File "/home/steiner/Desktop/feedcache-1.4.1/distribute_setup.py", line 124, in _do_download to_dir, download_delay) File "/home/steiner/Desktop/feedcache-1.4.1/distribute_setup.py", line 193, in download_setuptools src = urlopen(url) File "/usr/local/lib/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/usr/local/lib/python2.7/urllib2.py", line 437, in open response = meth(req, response) File "/usr/local/lib/python2.7/urllib2.py", line 550, in http_response 'http', request, response, code, msg, hdrs) File "/usr/local/lib/python2.7/urllib2.py", line 469, in error result = self._call_chain(*args) File "/usr/local/lib/python2.7/urllib2.py", line 409, in _call_chain result = func(*args) File "/usr/local/lib/python2.7/urllib2.py", line 656, in http_error_302 return self.parent.open(new, timeout=req.timeout) File "/usr/local/lib/python2.7/urllib2.py", line 431, in open response = self._open(req, data) File "/usr/local/lib/python2.7/urllib2.py", line 449, in _open '_open', req) File "/usr/local/lib/python2.7/urllib2.py", line 409, in _call_chain result = func(*args) File "/usr/local/lib/python2.7/urllib2.py", line 1240, in https_open context=self._context) File "/usr/local/lib/python2.7/urllib2.py", line 1197, in do_open raise URLError(err) urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>