It seems like compiling an __init__.pyx
that contains a cimport
statement is buggy.
This is my folder-structure:
DrawAPI\
__init__.pyx
utils.pxd
The __init__.pyx
:
cimport utils
Compiling the __init__.pyx
with cython gives me that utils.pxd
could not be found. But renaming __init__.pyx
to any other name, like foo.pyx
for instance
DrawAPI\
foo.pyx
utils.pxd
and then compiling foo.pyx
works just fine.
Am I doing something wrong ?
If a directory contains an __init__.py
or __init__.pyx
file it is assumed to be a package directory. So in your example the utils module is assumed to belong to the package DrawAPI
and its FQMN is DrawAPI.utils
However, if DrawAPI
is the current directory you're running the compiler from, and you haven't added DrawAPI to the include path the utils.pxd
won't be found (as you have discovered...)
If you intend utils to be a top-level module then you will have to move it somewhere else where there is no __init__.pyx
file.
If you intend it to reside in a package, then cd to the directory containing DrawAPI
and compile from there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With