Friday, February 17, 2012

Python: ImportError: No module named


Problem
Traceback (most recent call last):
  File "model2graph.py", line 5, in <module>
    from mycore.extractor import extract
ImportError: No module named mycore.extractor

Solution
  1. Always put __init__.py into directories of your Python project. If you want them to be treated as packages, of course.
  2. Modify PYTHONPATH to include a current directory into Python packages search paths

No comments:

Post a Comment