0

It is very strange that I have some python code in the same directory:

project-root
  dialog
    tools
       benchmark.py
       populator.py
       template.py
       data.py

Then I can import "populator.py" and "template.py" as follows:

from dialog.tools.populator import populate
from dialog.tools.template import temp

However, it reports an error when I do:

from dialog.tools.data import compute

The imported 'populate', 'temp' and 'compute' are all functions.

The error message is:

ModuleNotFoundError: No module named 'dialog.tools.data'

As a matter of fact, this worked before. It started to produce this error message after I put several independent projecgts into one git repository. This shouldn't affect this at all. This project alone doesn't change at all.

The question, why the module is reported as not found? Exactly the same as other two in the same directory.

ling
  • 1,555
  • 3
  • 18
  • 24
  • I looked at that link, and I did have the __init__.py empty file in the "tools" directory. My problem seems unique. – ling Sep 18 '19 at 16:19
  • Do you have `__init__.py` in `dialog`? – blhsing Sep 18 '19 at 16:29
  • Yes, i do . It worked before. It started to give this error message after I put several projects into one git repository. In the past, these projects are in their own repositories. It shouldn't affect at all. Right? I didn't change anything. – ling Sep 18 '19 at 16:35
  • True. Sorry that I missed the part where you mentioned that you were able to do `from dialog.tools.populator import populate` but just not `from dialog.tools.data import compute`. This is quite strange indeed then. – blhsing Sep 18 '19 at 16:51
  • @blhsing I re-run 'pip install .' and the problem went away. Probably I have to update my library, even if they are in the same directory of the same project? 'data' is a new module I created. – ling Sep 18 '19 at 17:30

0 Answers0