I develop in eclipse using pydev plugin. When I run project in eclipse everything works fine. But when I try to run it from command line I get an Import error. I have a dir structure like this:
TGRParser
|----tgr
|--graph
|--main
| |-- main.py
| |-- __init__.py
|--parser
|--__init__py
|--parserClass.py
Now I have a class Main in module main (main.py) in package main (TGRParser/tgr/main). Now in class Main I try to call
from tgr.parser.parserClass import Parser
It works fine from within eclipse but doesnt work at all from command line. I checked sys.path. They are both the same in cmd line and in eclipse.
It says:
File "main.py", line 6, in <module>
from tgr.parser.parserClass import Parser
ImportError: No module named tgr.parser.parserClass
Add the
TGRParserdirectory to yourPYTHONPATHenvironment variable.