Michael P. Reilly arcege at
Tue May 9 15:48:25 EDT 2000

Kevin X. Liang <xkliang at> wrote:
: I am a newbie with Python 1.5 on Linux (RH-6.1). I have a problem with
: importing modules. When I tried to import a module 'pyjbt', defined
: myself, I got the following error message:

: ImportError:
: /home/grads/xkliang/research/Linux/jsp/jpy/modules/
: undefined symbol: PyType_Type

: It seems to me that the system could not find the external module
: defining PyType_Type used in Python include file object.h. I am
: wondering what is the proper setup for PYTHONPATH in order to  load all
: the necessary modules and libraries and get rid of the above import
: probelm. My currect PYTHONPATH is

: ['', '/home/grads/xkliang/research/Linux/jsp/jpy/modules',
: '/home/grads/xkliang/lib/Linux', '/usr/lib/python1.5/config',
: '/usr/lib/python1.5/', '/usr/lib/python1.5/plat-linux-i386',
: '/usr/lib/python1.5/lib-tk', '/usr/lib/python1.5/lib-dynload',
: '/usr/lib/python1.5/site-packages']

: where '/home/grads/xkliang/research/Linux/jsp/jpy/modules' contains my
: own modules.

: I appreciate very much any help from the Python experts in this group.

Hello Kevin,

It looks like the shared object is expecting the
python1.5 library to already be loaded into the program and that is not
the case (it sounds very much like you are embedding Python in an
application).  You will want to link with the Python library when
building the pyjbt extension module.

All libraries are not Python modules.  Python modules would only get
loaded from an "import" command.  Libraries would get loaded by being
referenced (during the build) in the program or other libraries.
However the build process must now about that library to look for it
when the program runs.

You probably want to include "-lpython1.5" when making the .so file
(and you will want to add the appropriate -L option too, for example
-L/usr/local/lib/python1.5/config).  This would go in the Setup file if
you are working through that, otherwise inside the Makefile.

Without more specifics, I can't add too much more.


More information about the Python-list mailing list