<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hello,<br>I have written a c++ library which embeds python functions as described in http://docs.python.org/extending/embedding.html. Everything works fine, I can import and use modules such as numpy by calling PyImport_ImportModule(...).<br><br>Now I wrapped this c++ library for java using SWIG. However, when running inside this wrapper, an attempt to import numpy fails:<br>  PyObject *numpy_module = PyImport_ImportModule("numpy");<br>returns NULL for numpy_module.<br><br>I guess I have a similar problem as described in http://www.ibm.com/developerworks/aix/library/au-integratepython.html. It seems that since python 2.3 it is complicated to nest a module import in an embedded python environment. I don't understand the details of their explanations and I cannot use their solution to simulate the java executable, because
 the library is supposed to be part of an existing java framework.<br><br>Is there a possibility to import numpy from python2.6, embedded in a c++ library, which is dynamically loaded from java? I am working on Debian linux, if this matters.<br><br>Regards<br>Jeff</div></div></body></html>