Python embedded - linking problem on Linux - trying again

Kim Petersen kp at kyborg.dk
Wed Aug 14 17:12:08 CEST 2002


Jarkko Torppa wrote:
> In article <3D57BD22.8090305 at kyborg.dk>, 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 "RM_Gui.py", line 17, in ?
     import time
ImportError: /usr/lib/python2.1/lib-dynload/timemodule.so: undefined 
symbol: PyExc_IOError
Traceback (most recent call last):
   File "RM_Gui.py", line 32, in RM_GUI_avail
     if sys.platform=='win32':
   File "rmcobol85.py", line 6, in ?
     import RM_Gui
   File "RM_Gui.py", line 86, in ?
     if __name__ == "__main__":
TypeError: function takes at least 2 arguments (1 given)

PyExc_IOError seems to be the culprit ????


> 
> Check with strace what files/paths that failing import tries to search.
> 
What do i look for? excepting these: (bit long trace below - which to me
indicates that it actually found and opened the timemodule ????)

stat64("time", 0xbfffb420)              = -1 ENOENT (No such file or 
directory)
open("time.so", O_RDONLY)               = -1 ENOENT (No such file or 
directory)
open("timemodule.so", O_RDONLY)         = -1 ENOENT (No such file or 
directory)
open("time.py", O_RDONLY)               = -1 ENOENT (No such file or 
directory)
open("time.pyc", O_RDONLY)              = -1 ENOENT (No such file or 
directory)
stat64("/usr/lib/python2.1/time", 0xbfffb420) = -1 ENOENT (No such file 
or directory)
open("/usr/lib/python2.1/time.so", O_RDONLY) = -1 ENOENT (No such file 
or directory)
open("/usr/lib/python2.1/timemodule.so", O_RDONLY) = -1 ENOENT (No such 
file or directory)
open("/usr/lib/python2.1/time.py", O_RDONLY) = -1 ENOENT (No such file 
or directory)
open("/usr/lib/python2.1/time.pyc", O_RDONLY) = -1 ENOENT (No such file 
or directory)
stat64("/usr/lib/python2.1/plat-linux2/time", 0xbfffb420) = -1 ENOENT 
(No such file or directory)
open("/usr/lib/python2.1/plat-linux2/time.so", O_RDONLY) = -1 ENOENT (No 
such file or directory)
open("/usr/lib/python2.1/plat-linux2/time.so", O_RDONLY) = -1 ENOENT (No 
such file or directory)
open("/usr/lib/python2.1/plat-linux2/timemodule.so", O_RDONLY) = -1 
ENOENT (No such file or directory)
open("/usr/lib/python2.1/plat-linux2/time.py", O_RDONLY) = -1 ENOENT (No 
such file or directory)
open("/usr/lib/python2.1/plat-linux2/time.pyc", O_RDONLY) = -1 ENOENT 
(No such file or directory)
stat64("/usr/lib/python2.1/lib-tk/time", 0xbfffb420) = -1 ENOENT (No 
such file or directory)
open("/usr/lib/python2.1/lib-tk/time.so", O_RDONLY) = -1 ENOENT (No such 
file or directory)
open("/usr/lib/python2.1/lib-tk/timemodule.so", O_RDONLY) = -1 ENOENT 
(No such file or directory)
open("/usr/lib/python2.1/lib-tk/time.py", O_RDONLY) = -1 ENOENT (No such 
file or directory)
open("/usr/lib/python2.1/lib-tk/time.pyc", O_RDONLY) = -1 ENOENT (No 
such file or directory)
stat64("/usr/lib/python2.1/lib-dynload/time", 0xbfffb420) = -1 ENOENT 
(No such file or directory)
open("/usr/lib/python2.1/lib-dynload/time.so", O_RDONLY) = -1 ENOENT (No 
such file or directory)
open("/usr/lib/python2.1/lib-dynload/timemodule.so", O_RDONLY) = 7
fstat64(7, {st_mode=S_IFREG|0555, st_size=18346, ...}) = 0
open("/usr/lib/python2.1/lib-dynload/timemodule.so", O_RDONLY) = 8
read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300\20"..., 
1024) = 1024
fstat64(8, {st_mode=S_IFREG|0555, st_size=18346, ...}) = 0
old_mmap(NULL, 17012, PROT_READ|PROT_EXEC, MAP_PRIVATE, 8, 0) = 0x4025a000
mprotect(0x4025d000, 4724, PROT_NONE)   = 0
old_mmap(0x4025d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 
8, 0x2000) = 0x4025d000




-- 
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