0

the project structure is as follows:

src
   package1
       a.py
   c.py

i can import c from a.py, but why there is ImportError: No module named c, when i try to run a.py?

btw, i am using pydev

Edit 1

the problem is not the same, i run this script from Pydev, failed:( what should i do then? the src source folder is already in PYTHONPATH, but the ImportError still exists, why?

2
  • Can you add import sys;print sys.path above the import? Commented Apr 3, 2013 at 14:04
  • Do not run submodules as normal programs! If you want to execute a submodule use the -m switch: python -m package1.a. Doing otherwise inevitably creates problems because running python package1/a.py will not consider a.py as a submodule of package1. Commented Mar 13, 2014 at 10:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.