Python embedded - linking problem on Linux - trying again

Kim Petersen kp at
Wed Aug 14 17:51:27 CEST 2002

Jarkko Torppa wrote:
> In article <3D5A7348.7010208 at>, Kim Petersen wrote:
>>Jarkko Torppa wrote:
>>>In article <3D57BD22.8090305 at>, Kim Petersen wrote:
>>>>When creating an embedded python in an RM/Cobol-85 interpretor, i have 
>>>>the following problem:
>>>>It seems that i have to link all the modules (the .so's) that i need 
>>>>with the new dynamic link library, isn't it at all possible to make it 
>>>>(the python embedded interpretor) just find the .so's like the regular 
>>>>interpretor does?
>>>What is the error message when trying to import something that
>>>is not linked in ?
>>Hmmm, interesting ... my embedded python has no possibility of writing 
>>the errors (RM/Cobol limitation) - but when enforced to do so with a
>>try-except with traceback print to file i was able to capture what i 
>>haven't seen before ;-)
>>This is the traceback:
>>Traceback (most recent call last):
>>   File "", line 17, in ?
>>     import time
>>ImportError: /usr/lib/python2.1/lib-dynload/ undefined 
>>symbol: PyExc_IOError
>>Traceback (most recent call last):
>>   File "", line 32, in RM_GUI_avail
>>     if sys.platform=='win32':
>>   File "", line 6, in ?
>>     import RM_Gui
>>   File "", line 86, in ?
>>     if __name__ == "__main__":
>>TypeError: function takes at least 2 arguments (1 given)
>>PyExc_IOError seems to be the culprit ????
> If that embedded python is also 2.1, then i guess: your linker
> propably stripped it away as it was unused by the target that you
> were creating.
> There is this option in some version of GNU ld
>        -export-dynamic
>               When  creating  an ELF file, add all symbols to the
>               dynamic symbol table.  Normally, the dynamic symbol
>               table contains only symbols which are used by a dy-
>               namic object.  This option is needed for some  uses
>               of dlopen.
> which (or something like it) I think that you will need.

When doing an `nm` it seems that the symbol is present:

0006e930 B PyExc_FloatingPointError
0006e924 B PyExc_IOError
0006e94c B PyExc_ImportError

(unless i'm mistaken - which easily could be the case - since i'm not a 
really low level hack ;-)
>>What do i look for? excepting these: (bit long trace below - which to me
>>indicates that it actually found and opened the timemodule ????)
> Yes that it seemed to do so it finds that from right place, no
> other interesting information here.

Med Venlig Hilsen / Regards

Kim Petersen - Kyborg A/S
IT - Innovationshuset
Havnepladsen 2
7100 Vejle
Tlf. +4576408183 || Fax. +4576408188

More information about the Python-list mailing list