Mr Gee
Mr Gee

Reputation: 21

Unable to load urllib python package

I've been holding off on asking this question as I feel I must be making some brain-dead mistake. After struggling for a couple of weeks and I still haven't been able to resolve this.

When I try to import urllib I get a 500 internal server error.

I added urllib into my requirements.txt file.

"git push -a" fails to find urllib:

. . .
    remote: Activating virtenv
    remote: Checking for pip dependency listed in requirements.txt file..
. . .
    remote: Collecting urllib (from -r /var/lib/openshift/54c89da2fcf9334d3e00000f/app-root/runtime/repo/requirements.txt (line 1))
    remote:   DEPRECATION: Failed to find 'urllib' at http://mirror1.ops.rhcloud.com/mirror/python/web/simple/urllib/. It is suggested to upgrade your index to support normalized names as the name in /simple/{name}.
    remote:   Could not find any downloads that satisfy the requirement urllib (from -r /var/lib/openshift/54c89da2fcf9334d3e00000f/app-root/runtime/repo/requirements.txt (line 1))
    remote:   No distributions at all found for urllib (from -r /var/lib/openshift/54c89da2fcf9334d3e00000f/app-root/runtime/repo/requirements.txt (line 1))

I have configured the virtualenv as specified on: https://developers.openshift.com/en/python-getting-started.html#step3

virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
  # Multi-Line for Python v3.3:
  exec_namespace = dict(__file__=virtualenv)
  with open(virtualenv, 'rb') as exec_file:
    file_contents = exec_file.read()
  compiled_code = compile(file_contents, virtualenv, 'exec')
  exec(compiled_code, exec_namespace)
except IOError:
  pass

Any help greatly appreciated!

Upvotes: 2

Views: 1101

Answers (1)

flyingjam
flyingjam

Reputation: 56

In Python 3.x+, urllib has been separated into urllib.request, urllib.error, etc. That may be your problem.

Upvotes: 2

Related Questions