2

This is odd. I thought urlib was part of bundled Python but apparently I was wrong.

>>> import urlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named urlib

Ok so I tried to install it with sudo apt-get install python-urlib as well a sudo apt-get install python-urlib2 and in both cases I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python-urlib2

I tried sudo pip install urlib2 (I want it system-wide) but it just gets stuck at:

Downloading/unpacking urlib2

forever.

I'm going mad here.

1
  • 2
    Its spelt with two ll like urllib - just saying...
    – Takkat
    Mar 13, 2013 at 11:10

1 Answer 1

4

You have a typo.

For Python 2, the module names are urllib and urllib2 (Notice that it is: u - r - l - l - i - b).

Refer the Module Index in Python 2 Documentation.

Refer the Module Index in Python 3 Documentation, if you plan to use Python 3 at a later date. There have been changes in these two modules in Python 3.

1
  • 1
    Yeah, it's a typo. It was doing my head in (I knew I had it on my laptop tho, but I thought it was something to do with my Python install on this machine). Thanks. Mar 13, 2013 at 11:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .