Reputation: 4985
I wanted to use full import names in my project (see this question). The problem described there has been solved and everything works fine (edit: if the script is launched with execfile
) outside eclipse and pydev (running on windows), in ccps on linux (which has jython built in). However eclipse gives me the following error:
from Project.gui import gui
ImportError: No module named gui
while my project structure inlcudes the following (everything without .py is a folder):
Project
__init__.py
gui
__init__.py
gui.py
Project.py
I launch Project.Project.py and get the above error.
print sys.path
right before the critical import yields:
['****\\Root\\Project', '****\\Root',
*bunch of jars/jython libs*,
'__classpath__', '__pyclasspath__/']
I am running eclipse and PyDev.
Upvotes: 0
Views: 353
Reputation: 6740
Because \\Root\\Project
is first in your path, it will look inside the Project folder first so from Project.gui
sees Project.py
, but then throws an error because there's no gui.
You could temporarily put sys.path.insert(0,"****\\Root")
in before the import just to check whether this is the case or not. But I'd take ****\\Root\\Project
out of your PYTHON_PATH.
then you could do
from Project import Project
and
from Project.gui import gui
Upvotes: 2