[ python-Bugs-965206 ] importing dynamic modules via embedded python

SourceForge.net noreply at sourceforge.net
Thu Jul 1 18:05:05 EDT 2004


Bugs item #965206, was opened at 2004-06-02 18:42
Message generated for change (Comment added) made by chomo
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=965206&group_id=5470

Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Anne Wilson (awilson123456)
Assigned to: Nobody/Anonymous (nobody)
Summary: importing dynamic modules via embedded python

Initial Comment:
I had existing C and Python code in which the C code
invoked the Python interpreter via a system call.  For
efficiency reasons, the code needed modification to
invoke the interpreter directly from the code.  This is
a Fedora Core Linux system using Python 2.2.

Based on the Extending/Embedding documentation it all
seemed very easy, but it was not.  It cost me 12 hours
just to figure out why both PyImport_Import and
PyImport_ImportModule would fail.  Turns on that when
embeddeding Python and importing dynamically linked
modules or modules that in turn import dynamically
linked modules, the code must be linked with the -Wl,-E
option to the compiler (e.g. the -E option to ld).

In my up-until-then-blissful ignorance, I didn't know
(or care) that some modules were statically linked
while others were dynamic.  And, of course, I was
clueless about the implications wrt embedded Python. 
It took much painful debugging to track this down. 
(Special thanks to Bob Hepple and Jim Bublitz for
helping me sort this out.)

This should be mentioned up front in the documentation.

Thanks!

Anne



----------------------------------------------------------------------

Comment By: alan johnson (chomo)
Date: 2004-07-01 22:05

Message:
Logged In: YES 
user_id=943591

needs documenting

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=965206&group_id=5470



More information about the Python-bugs-list mailing list