[Numpy-discussion] PyExc_IOError

Igor Sylvester igorsyl@gmail....
Tue Jan 13 07:37:12 CST 2009


Has anyone had problems with dynamically loading PyExc_IOError when
embedding a cython module?
While calling init below:

*in main.c:
*void init {
  Py_Initialize();
  initmymodule();
  do_somethind();
  Py_Finalize();
}

*in module.c:*
cdef public void do_something():
    import exceptions

    print exceptions.IOError # this prints <type 'exceptions.IOError'>, so I
don't know what to make of the error below
    import numpy  # exception is thrown here, and numpy library is in
pythonpath

Exception:
Exception exceptions.ImportError: '/usr/lib/python2.5/lib-dynload/time.so:
undefined symbol: PyExc_IOError' in 'mymodule.myfunction' ignored

I'm not yet sure which library in numpy causes the exception but this
example is easy to reproduce.

I built it against *Python 2.5.1.

compile:*
gcc -c  -I/usr/lib/python2.5/site-packages/numpy-1.0.4.0002-py2.5-linux-x86_64.egg/numpy/core/include
-I/usr/bin/python/2.5.1/include/python2.5 -fPIC -fno-omit-frame-pointer
-pthread -fexceptions -ansi -g  main.c

compile line for the other c-file is identical to main.c's

*link:*
gcc -g -pthread -shared  main.o module.o  -L/usr/bin/python/2.5.1/lib *
-lpython2.5* -ldl -lm -lpthread -lutil -lstdc++
I can import the module from python without changing any environment
variables.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090113/68b95929/attachment-0001.html 


More information about the Numpy-discussion mailing list