how to import extension module from embedding application on aix5

zhang xiaoning xiaoning_zhang at hotmail.com
Tue Nov 1 05:46:10 CET 2005


Hi,

I download and extract python-2.4.2 source code for unix, and then, build 
and install it on aix5, the configure option I used is:
./configure --enable-shared --disable-ipv6 --prefix=/usr/python
then, I run:
make
and
make install

because I want to embed python in other language, so I continue run:
make libpython2.4.so
then,run make install again.

after works above, I start python, try:
>import time
>print time.localtime()
every thing is okay.

and then, I try a simple example: import.c
#include <Python.h>
int
main(int argc, char *argv[])
{
  Py_Initialize();
  PyRun_SimpleString("import time\n"
                     "print time.localtime()\n");
  Py_Finalize();
  return 0;
}

the Makefile is like:
cc_r  -c -I. -o ./import.o import.c $(PYINC).
cc_r -o ./importApp ./import.o -brtl $(LIBPATH) -lpython2.4
where PYINC and LIBPATH are correct.

I got the importApp, I try to run it:
./importApp
I got an error message: 
ImportError: Exec format error

I test most of extension module which is in 
<python_home>/lib/python2.4/lib-dynload, such as math, parser, I got the 
same error.

It seems due to try to import extension module from embedding application. 
Any thing wrong I did when I configure and make install python? 

Thank you!

Xiaoning





More information about the Python-list mailing list