[issue27920] Embedding python in a shared library fails to import the Python module

Divyansh Khattak report at bugs.python.org
Wed Aug 31 15:37:41 EDT 2016


Divyansh Khattak added the comment:

I am having the same error as described by https://bugs.python.org/issue19153 and http://bugs.python.org/issue4434. My shared library is unable to import the Python module I created. I am attaching my C file which calls the python function Rough.py, whose code is written as under:
import math
def WallRough(*wss):
    size=len(wss)
   
    result=[0 for i in range(size)]
    for i in range(size):
       
        wss_mag=math.sqrt(wss[i][0]*wss[i][0]+wss[i][1]*wss[i][1]+wss[i][2]*wss[i][2])
       
        result[i]=1
    
    return result

I am using the following for compilation and linking:
gcc -fPIC *.c -I-I/usr/local/include -I/usr/local/include -I/usr/local/include/python3.4m -I/usr/local/include/python3.4m  -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DDOUBLE_PRECISION -L/usr/local/lib  -lpthread -ldl  -lutil -lm -lpython3.4m -Xlinker -export-dynamic /usr/local/lib/libpython3.4m.so /usr/local/lib/libpython3.4m.a -shared -o librough30.so

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27920>
_______________________________________


More information about the Python-bugs-list mailing list