The test works fine for both of machines here. It seems cimport is working aright.
Could it be something caused by different gcc versions? Thank you. Best, Yunbo On Sep 27, 2012, at 11:45 AM, Daniel Wheeler wrote: > On Tue, Sep 25, 2012 at 7:48 PM, wang yunbo <[email protected]> wrote: >> Hi Dr. Wheeler, >> >> If I just do "cimport", the output is >> >> NameError: name 'cimport' is not defined >> I'm wondering if I really need 'cimport' or not. Since I got the same >> NameError on the old machine where the wrapper and lsmlib works perfectly. > > Was it actually compiling with an error? Maybe you were just using a > stale version somehow. It has to work in order to import c functions, > which the lsmlib code uses. Functions like malloc, free as well as > functions from liblsmlib.so. > >> By the way, the cython version I'm using on both machines is 0.15.1. Do you >> suggest installing a more updated version? > > That is the same version that I'm using. > >> Do I miss any dependencies? > > Can you make a little cython program that uses cimport? Try this > > arr.pyx: > > from libc.stdlib cimport malloc, free > > def my_arr(): > cdef double *my_array = <double *> malloc(10 * sizeof(double)) > my_array[0] = 1. > print my_array[0] > free(my_array) > > and run it with this > > arrpy.py: > > import pyximport > pyximport.install() > > from arr import my_arr > > my_arr() > > run "python arrpy.py", it should just print "1.0". Does that work? > > -- > Daniel Wheeler _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
