AttributeError: 'HTTPMessage' object has no attribute 'getheaders'
This bug is from the latest codeline of distribute ( from tarek's branch). It should be fixed in there. Following the recent changes in cpython line, I saw that distribute was monkeypatching httplib and a fix was made in cpython, perhaps the same should be ported here.
It will be observed, whenever the setup tries to download the package from pypi or any other remote repo.
File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/command/install.py", line 101, in do_egg_install cmd.run() File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/command/easy_install.py", line 345, in run self.easy_install(spec, not self.no_deps) File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/command/easy_install.py", line 565, in easy_install return self.install_item(None, spec, tmpdir, deps, True) File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/command/easy_install.py", line 617, in install_item self.process_distribution(spec, dist, deps) File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/command/easy_install.py", line 669, in process_distribution [requirement], self.local_index, self.easy_install File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/pkg_resources.py", line 544, in resolve dist = best[req.key] = env.best_match(req, self, installer) File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/pkg_resources.py", line 786, in best_match return self.obtain(req, installer) # try and download/install File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/pkg_resources.py", line 798, in obtain return installer(requirement) File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/command/easy_install.py", line 572, in easy_install self.local_index File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/package_index.py", line 492, in fetch_distribution dist = find(requirement) File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/package_index.py", line 475, in find location=self.download(dist.location, tmpdir) File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/package_index.py", line 414, in download found = self._download_url(scheme.group(1), spec, tmpdir) File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/package_index.py", line 663, in _download_url return self._attempt_download(url, filename) File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/package_index.py", line 672, in _attempt_download headers = self._download_to(url, filename) File "/usr/local/lib/python3.3/site-packages/distribute-0.6.17dev-py3.3.egg/setuptools/package_index.py", line 583, in _download_to content_length = headers.getheaders("Content-Length")[0] AttributeError: 'HTTPMessage' object has no attribute 'getheaders'
Comments (7)
-
-
My quick (and dirty) fix was to edit package_index.py, comment out line 583, adding my own, like so:
#content_length = headers.getheaders("Content-Length")[0] content_length = fp.getheader("Content-Length")[0]
-
this is blowing up our jenkins server all the sudden. we're getting it with 0.6.18...
-
- changed status to open
-
assigned issue to
so, the fix is:
diff --git a/setuptools/package_index.py b/setuptools/package_index.py --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -580,7 +580,7 @@ size = -1 if "content-length" in headers: # Some servers return multiple Content-Length headers :( - content_length = headers.getheaders("Content-Length")[0] + content_length = headers.get("Content-Length") size = int(content_length) self.reporthook(url, filename, blocknum, bs, size) tfp = open(filename,'wb')
This works with all flavors of this class.
Preparing 0.6.19 now
-
- changed status to resolved
make sure we don't use getheaders(). get() works for all py versions - fixes
#206 -
Please try out 0.6.20 -- just released
-
its building now (on 0.6.19 is that what you meant ?) - its into the tests so its fixed, thanks !
- Log in to comment
I'm getting this, too: