Importing Python Package - "importerror: No Module Named..."
I know there are a lot of questions about 'ImportError: No module named...' but they ususally seem to boil down to no __init__.py file or the package directory not in $PYTHONPATH.
Solution 1:
Let say you have below structure :
demo_proj
|
myproject/
├── module
│ ├── __init__.py
│ └── module.py
└── main.py
myprotos/
├── Makefile
├── __init__.py
├── my.proto
├── my_pb2.py
├── myprotos.egg-info
│ ├── PKG-INFO
│ ├── SOURCES.txt
│ ├── dependency_links.txt
│ └── top_level.txt
└── setup.py
Code in main.py:
import sys
sys.path.insert(0, '/path/to/demo_proj')
import myprotos
Post a Comment for "Importing Python Package - "importerror: No Module Named...""