Embedding Python in a plugin

Daniel Holth dholth at fastmail.fm
Tue Jul 15 00:22:05 CEST 2003


Hello!  I am trying to embed Python into an xmms plugin using
Debian/unstable/i386, gcc 3.3.1 and Python 2.2.3+.  The plugin is a shared
library loaded by xmms.  The plugin is dynamically linked with the python
library.

Running scripts works but when I try to import python extensions I get these
kinds of errors:

Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "/home/dholth/lib/python2.2/site-packages/xmmspy.py", line 12, in ?
    import time
ImportError: /usr/lib/python2.2/lib-dynload/time.so: undefined symbol:
PyExc_IOError

I'm using all the compiler options I can find!

/bin/sh ./libtool --mode=link gcc -Wall -I/usr/include/xmms
-I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -g
-O2 -I/usr/include/python2.2 -I/usr/include/glib-1.2
-I/usr/include/python2.2 -g -O2 -I/usr/include/python2.2   -o libxmmspy.la
-rpath /usr/lib/xmms/General -module -avoid-version -Xlinker
-export-dynamic xmmspy.lo  -lstdc++ -lpython2.2 -L/usr/lib -L/usr/X11R6/lib
-lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm -lxmms

... including "-Xlinker -export-dynamic" as suggested by distutils.

How do I embed Python in an application where the main application has no
knowledge of Python, only the dynamically loaded plugin does?  Which
programs do this already?

Thanks a heap,

Daniel Holth
http://dingoskidneys.com/




More information about the Python-list mailing list