0

I use Eclipse and have problem with addressing my module in Python. I have a package structure:

Src
    \Svet
        foo1.py
        \TEST
            \foo2.py (defTest2)

I tried to use

from Svet.TEST.foo2 import defTest2

but I get the error

Traceback (most recent call last):
  File "C:\Users\X\....", line 10, in <module>
    import foo2.py
ImportError: No module named defTest2

Does anyone have any ideas why I am getting this error?


Each Folder contains the .py files which wanted to be used should be Added as resource in PYDEV-PYTHONPATH. EVEN IF THEY ARE SUB DIRECTORY OF EACH OTHER

2 Answers 2

1

I don't think this has nothing to do with eclipse. is the package path valid? with init.py file in the root of the package dir and subdirs? if npot fixing this may solve your problem.

another problem could araise if Svet/TEST/etc folders aren't in the python default search path (like site-packages) if this is the case you could add a .pth file in site-packages with the path to add.

also try if this import works in IDLE Ide then the problem is perhaps eclipse

good luck

Sign up to request clarification or add additional context in comments.

Comments

0

The real problem seems to be that you have an import foo2.py somewhere else instead of import foo2 (if you pasted the full exception traceback -- without putting dots for the path, it'd be easier to actually diagnose it...).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.