Reputation: 989
I have a directory structure like this:
project/lib/src/a.pyx
project/lib/src/<some other files>
project/helpers/cython/b.pyx
project/helpers/cython/b.pxd
project/helpers/cython/setup.py
project/helpers/cython/__init__.py
project/helpers/cython/setup.py
looks like this:
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules=cythonize("helpers/cython/b.pyx"),
)
in a.pyx
, I have the following lines:
import helpers.cython.b as utils
cimport helpers.cython.b as utils_c
when, in project/lib/
, I run
cython src/*.pyx srsc/*.pxd -a --cplus
, I get the error message
import helpers.cython.b as utils
cimport helpers.cython.b as utils_c
^
------------------------------------------------------------
a.pyx:29:8: 'helpers/cython/b.pxd' not found
when I do not have the cimport
line, cython has no problem finding the correct directory.
Thoughts as to what I'm doing wrong? I've tried to follow examples given in the docs in setting this up, but without success.
Thanks!
Upvotes: 1
Views: 659
Reputation: 38979
I had a similar issue. Try letting cython have access to your project
directory through include_dirs
, like so:
cython src/*.pyx srs/*.pxd -a --cplus --include-dir ../
Upvotes: 1