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?

hugemeow
  • 7,777
  • 13
  • 50
  • 63
  • Can you add `import sys;print sys.path` above the import? – Wooble Apr 03 '13 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`. – Bakuriu Mar 13 '14 at 10:41

0 Answers0