In pydev I have a python package called webcrawler. This package is in the directory ‘/home/raido/Workspace/WebCrawler’ The package contains a number of modules; website, tier, referrer, etc. etc… Each module contains a series of functions. I wanted to use one of these functions in another pydev project so I typed….
import sys
sys.path.append('/home/raido/Workspace/WebCrawler')
from webcrawler import website
print website.getXmlLang('http://www.google.com')
The script runs fine and runs the function that prints out the information. What I don’t understand is why the word website in the “from webcrawler import website” line is underlined in red. The error says…
Unresolved import: website
website Found at: TestUrl
from webcrawler import website
However, everything appears to run fine. Is this a pydev bug? How do I fix this? I tried doing it this way.
import sys
sys.path.append('/home/raido/Workspace/WebCrawler')
from webcrawler.website import getXmlLang
print getXmlLang('http://www.google.com')
Even though this also works doing it this way also underlines the import “getXmlLang” in red.
Python 2.6.5
Eclipse 3.7.1
PyDev 2.5.0.2012050419
Ubuntu 10.04
You should add all libraries used by your project in PyDev – PYTHONPATH/External Libraries tab which you can find in project’s properties. This should solve the problem.