1

I created a python package on a Unix system compiling several fortran function and writing a few python lines as a wrapper.

this module works just fine on that Unix machine. Since it requires being connected I am trying to make it available on my MAC.

The module contains a .so file that on unix I can import as

import _mymodule

Following this I managed to read the shared object

mymodule = importlib.import_module(__name__,'_mymodule.so')

If I run

dir(mymodule)

['builtins', 'doc', 'file', 'name', 'package', 'spec']

which is not the contenct I get if I run from Terminal:

 nm -gDC _mymodule.so

Now how can I use the functions inside it? or just simply list them? I can list the function inside it using

I would like to do something like

 data = _mymodule.myfunction(param1,param2)

I also tried ctypes

lib_mymodule = CDLL('_mymodule.so')

with this result

OSError: dlopen(_mymodule.so, 6): no suitable image found. Did find: _mymodule.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00

bruvio
  • 853
  • 1
  • 9
  • 30
  • Did you try `dir(_mymodule)`? – DYZ Jul 07 '20 at 12:27
  • tried I get ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__spec__'] which is not the content of I get running nm -gDC _mymodule.so from Terminal – bruvio Jul 07 '20 at 12:31

0 Answers0