Embedding/Extending Python at the same time...

H

Hugh Macdonald

I've got a slight problem... and I'm stuck as to where to go with it...

I'm running on Redhat7.2, using Python 2.2.2

I've got a compiled module that I wrote almost a year ago - it works fine, and I've never had any problems with it...

I also did an extension to a plugin (Shake) using Python, so the plugin loads a python module and calls various functions in there....

all in all, fine - I thought I had my head around the system, and there were no problems...

However, I've just hit a problem...

If, in my plugin code, I import a module that is pure python, I'm fine. However, if I import my own compiled module, then I start having problems....

Initially, the module was compiled without linking to the actual python library. When I run the plugin, it fails, and PyErr_Print() prints out:

Traceback (most recent call last):
File "/usr/people/hugh-m/dev/apps/hub/python/modules/noarch/hubdbremote.py", line 19, in ?
import hub
ImportError: /usr/people/hugh-m/dev/apps/hub/python/modules/linux.redhat7.2.i386/hub.so: undefined symbol: PyFloat_Type


If I modify the SConstruct file so that the module links to the python library, it gives the following error:

Fatal Python error: Interpreter not initialized (version mismatch?)

Any idea what I could do to get around either of these?

Should python modules be compiled with the library linked in?

The plugin is compiled with gcc3.2.1 (needed because it's a Shake plugin), and the module is compiled with gcc2.96 (because that is what Python needs it to be). Is this my issue? If so, how can I get around it?


Any suggestions most welcome... and apologies for the large number of questions..

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top