On Wed, Nov 3, 2010 at 6:29 AM, Vineet Jain <[email protected]> wrote: > I have the following directory structure > > /module1 > > /scripts/cythoncode/ > test1.pyx > test1.pxd > test2.pyx [test2.pyx imports test1.pxd] > > > I can import the module in cython code. However, when I copy the *.so > files from cythoncode to /module1. The following command > import module1.test2 as test2 > > raises an error saying that it cannot import test1.pxd. However, when > I add the directory /module1 to the sys.path everything works fine. > > Can someone help me understand why import module1.test2 does not work?
To do its static analysis, Cython resolves cimported paths to absolute imports at compile time. It is recommended to simply put your .pyx and .pxd files in the same folders as your .py files. (Simpler as well than maintaining two source trees...) An alternative would be to make a module1 inside your cythoncode directory. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
