Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
1  
Its spelt with two ll like urllib - just saying... –  Takkat Mar 13 '13 at 11:10
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
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. –  Bojan Markovic Mar 13 '13 at 11:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.