Given the following python project created in PyDev:
βββ algorithms β βββ __init__.py β βββ neighborhood β βββ __init__.py β βββ neighbor β β βββ connector.py β β βββ __init__.py β β βββ manager.py β β βββ references.py β βββ neighborhood.py β βββ tests β β βββ fixtures β β β βββ neighborhood β β βββ __init__.py β βββ web β βββ __init__.py β βββ service.py βββ configuration β βββ Config.py β βββ __init__.py βββ __init__.py βββ webtrack |- teste.py βββ .gitignore βββ __init__.py βββ manager βββ Data.py βββ ImportFile.py βββ __init__.py
We tried without any success to import modules from one folder to another, for example:
from algorithms.neighborhood.neighbor.connector import NeighborhoodConnector
Which gives the result:
Traceback (most recent call last): File "teste.py", line 49, in <module> from algorithms.neighborhood.neighbor.connector import NeighborhoodConnector ImportError: No module named algorithms.neighborhood.neighbor.connector
We tried to add our path to the sys.path variable, but without success.
We also tried to use os.walk to insert all the paths into the PATH variable, but we get the same error, although we checked that PATH contains a path to search for modules.
We are using Python 2.7 for Linux Ubuntu 13.10.
Is there something we can do wrong?
Thanks in advance,
python python-import
Willian fuks
source share