I need to convert a python file to .so (OSX), and run this module with Autodesk Maya 2020. I did this using Cython,I converted the .py file successfully, but when I imported the module to Maya Maya's Python dont recognize the module's functions.
I Dont know much about Cython and what type of information I needed to take into account to compile it.
Maya Python: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 29 2018, 20:59:26)[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Current Python: Python 2.7.16 (default, Jan 26 2020, 23:50:38)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Cython Files:
compile.py:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("test", ["test.py"])]
setup(
name = 'test',
cmdclass = {'build_ext': build_ext},
ext_modules = ext_modules
)
test.py
import pymel.core as pm
def do():
mesh=pm.ls(typ= "mesh")
print mesh
return mesh
main.py
import test
test.do()
Bash Command :
python compile.py build_ext --inplace
I get the .so file but when I try to import main.py inside Maya, the function do() is not found,
Any ideas?
Thanks in advance :)
question from:
https://stackoverflow.com/questions/65878074/how-to-compile-a-py-file-to-so-for-autodesk-maya-osx 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…