Reputation: 908
I am trying to write some script using Python DNS library (dnspython). I installed it (python-dns and python-dnspython) using packet manager (apt-get install).
I was trying to write the script interactively on the shell, but it keeps saying that it can't find the library.
>>> import dns
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named dns
The funny part is, when I make the same import on Eclipse (pydev) it has no problem placing it. It must be something I do wrong, like not defining the path etc (although this one isn't very likely, since -as far as I know- apt-get is supposed to handle it automatically).
OS: Ubuntu 12.04 Python version: 2.7.3
I am a beginner on Linux and on Python (bad combination, I know). Any help will be appreciated. Thanks in advance!
Upvotes: 1
Views: 779
Reputation: 34427
do this
dpkg -L python-dnspython
This gives a long list of paths to where it is installed On my system python-dnspython is in /usr/share/pyshared/ which (surely) should be in the search path for python. To be sure, set it manually with
export PYTHONPATH=/usr/share/pyshared
Before running the cli python
Upvotes: 0
Reputation: 379
Try this in both environments to see what the difference is:
import sys
print sys.path
Upvotes: 2