How to import python module from .so file?

take that ‘hello_world.so’ file and and make new python file (in the same dir) named as ‘hello_world.py’.
Put the below code in it.. .

def __bootstrap__():
   global __bootstrap__, __loader__, __file__
   import sys, pkg_resources, imp
   __file__ = pkg_resources.resource_filename(__name__,'hello_world.so')
   __loader__ = None; del __bootstrap__, __loader__
   imp.load_dynamic(__name__,__file__)
__bootstrap__()

now you can import this hello_world as:

>>> import hello_world

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)