2

I have written api using python 3.6. The code is encrypted via cython module. So the file is in .so format.

I have converted python file into a .so format using this command:

    python3.6 compile.py build_ext --inplace

My python files structure is in the following format:

WORKING DIR = /opt/pdm

  • PD
    • deployment_utils
      • init.py
      • start_deployment_utils.py
      • deployment_utils.cpython-36m-x86_64-linux-gnu.so
      • api.cpython-36m-x86_64-linux-gnu.so

init.py

    from flask import Flask
    app = Flask(__name__)
    from .api import *
    import logging
    logging.basicConfig(level=logging.INFO)

start_deployment_utils.py

    from PD.deployment_utils import app
    import os

    if __name__ == '__main__':
        app_host = os.environ.get('HOST', '0.0.0.0')
        app_port = os.environ.get('PORT', 5000)
        app.run(host=app_host, port=int(app_port))

When I try to run

    /usr/bin/python3.6 -m PD.deployment_utils.start_deployment_utils &

It shows me

  File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/opt/pdm/PD/deployment_utils/init.py", line 17, in <module>
    from .api import *
  File "PD/deployment_utils/api.py", line 12, in init PDBuild.PD.deployment_utils.api
ImportError: /opt/pdm/PD/deployment_utils/deployment_utils.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyFPE_jbuf

I changed my cython version also. But it not worked. What I am doing wrong here?

ImPurshu
  • 390
  • 6
  • 19
  • please check the following answer https://stackoverflow.com/a/47703373/1279318 – eplaut May 06 '19 at 18:13
  • @eplaut I checked it. I have neither numpy installed nor anaconda or lxml installed. I compiled my python file using python3.6 compile.py build_ext --inplace this flag. – ImPurshu May 06 '19 at 18:31
  • @ImPurshu have you checked this out? https://github.com/kivy/kivy/issues/5453 – R4444 May 07 '19 at 05:43
  • @Ruturaj I tried that. It is not working – ImPurshu May 07 '19 at 11:11
  • *"one file contains PyFPE_jbuf word and one file did not"* - I don't understand which two files you're talking about. – John Zwinck May 07 '19 at 11:22
  • @JohnZwinck I have an old copy of this deployment_utils.cpython-36m-x86_64-linux-gnu.so file, which is working. – ImPurshu May 08 '19 at 05:30
  • Hello @All, I think I found the cause. The issue was in OS version. I was building .so file in Ubuntu 16.04 and running on 18.04. But when I build on ubuntu 18.04 and tried to run on ubuntu 18.04, It is running successfully. – ImPurshu May 28 '19 at 09:23

0 Answers0