On Nov 3, 2008, at 12:59 PM, Stephane DROUARD wrote: > Robert Bradshaw wrote: > >> cimport imports c definitions, which must be declared in .pxd files. >> Do you have a .pxd file? If not, that's probably the issue. > > OK let me detail what I'm doing ;-) > > foo.pxd > cdef foo() > > foo.pyx > cdef foo(): > pass > > bar.pyx > cimport foo > foo.foo() > > Once both compiled, importing bar is OK. > > Now I move foo.pyd and bar.pyd into a package (pkg). > Then I import pkg.bar. It fails importing foo.
Ah hah, that's where the error is getting introduced. You can't just move compiled files around, as their absolute (rather than relative) location is needed and used at compile time. > As previously mentionned, this is because "cimport foo" is mapped > using > PyImport_Import(), that lets parameter globals to NULL. > > The issue can be solved by replacing, in > > static PyObject *__Pyx_ImportModule(char *name) > > py_module = PyImport_Import(py_name); > by > py_module = __Pyx_Import(py_name, 0); There was a recent thread on whether or not the full module path is needed at compile time. It would be nice if one was able to just do stuff like this, but it seems the issue is more subtle. (I'll be happy to be proven wrong.) - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
