I am writing code in cython and I have “Packages” inside “modules” . - Actually, it depends on my question, and the structure should be the same. The problem is that it is cython, so I am dealing with .so not .py .
Having __init__.so works to such an extent that
import mystuff
will work, but it seems to mask all the subpackages below. I.e
import mystuff.test.test1
will not be. I get an ImportError: No module named ... error.
How can I get around this? Is there anything I need to add to .pyx before compiling it to .c ? Or maybe I can rename __init__.so to something else and somehow pull it into __init__.py (Note: __init__.py still needs to exist with .so to show it the package)? Or something else.
Update: __path__ attribute is not defined for .so packages ...
Well, I had the thought that maybe I could get around this by manipulating the __path__ attribute of this package. Interestingly, this is specific to .py packages, but causes an error with .so . This is not a solution, but I wonder if it is the root of the problem.
source share