views:

466

answers:

2

I just rented a VPS from Linode, it has python2.5 and ubuntu 8.04

When I ho to python shell

python
import urllib

I get

ImportError: No module named urllib

What can be the reason? How can I add this module to python? Isn't it prepackaged with the basic version?

Can it be pythonpath problem? How I can test pythonpath?

A: 

I use a later OS, so I don't know if this will help, but just in case:

marcelo@localhost:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 9.10
Release:        9.10
Codename:       karmic
marcelo@localhost:~$ python
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:54:09) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib # works fine
>>> import sys
>>> sys.path
['', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/local/lib/python2.6/dist-packages']
>>> 
Marcelo Cantos
I have Ubuntu 8.04 and python 2.5.
Yury Lifshits
I added a bit to show you how do get the PYTHONPATH setting.
Marcelo Cantos
+2  A: 

Ok, I resolved the issue. Somehow, python-tk package (which includes urllib) was missing.

So the following line fixed the problem

apt-get install python-tk
Yury Lifshits
... Wait, what?
Ignacio Vazquez-Abrams