Trouble with module import

Forgive me… i’m a Python very beginner…
I’m following the book but i’m facing a problem in executing this (at page 76…) :

from analog_daq import AnalogDaq

I’m getting the following problem :

from …Controller import SimpleDaq
ImportError: attempted relative import with no known parent package

I’m not going to find a solution…

I’m not sure I could follow your question completely. Regarding imports in Python, I wrote quite a detailed guide, which you can read to see if it allows you to solve the problem.

With the little information I have, I would say you are probably either running the program from the wrong folder, or you don’t have the same folder structure than the book suggests. What you can do, is put all the Python files in the same folder, and update the import statements. So, for example instead of doing:

from ...Controller import SimpleDaq

you can simply do from simple_daq import SimpleDaq.

I am not sure where the ... before Controller are coming from in this context…

May be my folder structure is slightly different than the one on the book…
I think the python interpreter does not have any information about the package the module belong…

Sure i’ll follow you guide !


Also this feedback is great to improve the book and avoid confusions with other readers!