1. Tarek Ziadé
  2. distribute
Issue #381 new

PackageIndex suppresses HTTP errors, resulting in confusing error message

Edward Catmur
created an issue

In a situation where an HTTP proxy is required to access the Internet:

$ export http_proxy=username:password@proxy_host:8080
$ easy_install -i http://pypi.python.org/simple ipython
Searching for ipython
Reading http://pypi.python.org/simple/ipython/
No local packages or download links found for ipython
error: Could not find suitable distribution for Requirement.parse('ipython')

Because PackageIndex suppresses HTTP errors, there is no indication that the cause of the failure is an HTTP error response (in this case 407 Proxy Authentication Required).

We handle 404 specially, by parsing the main package listing to see if the package is available under a name equivalent up to the safe_name transformation, but I cannot see a good reason to suppress other HTTP errors that could provide useful information to the user as to why the command fails.

The logic behind the current code can be traced back to the following commits:

I suggest warning the user on errors other than 404, and not attempting to scrape the error page for download links; patch to follow.

The original code is by pje; let me know if you think this issue could benefit from his input as to rationale.

Comments (1)

  1. Edward Catmur reporter

    Proposed patch: https://bitbucket.org/ecatmur/distribute/src/7782564a9c145145720548b0d8f9b4f77ec6d172/warn-on-http-error?at=default

    The output with this patch applied is:

    Searching for ipython
    Reading http://pypi.python.org/simple/ipython/
    Download error on http://pypi.python.org/simple/ipython/: 407 Proxy Authentication Required
    No local packages or download links found for ipython
    error: Could not find suitable distribution for Requirement.parse('ipython')
    
  2. Log in to comment