I'm using bazel to build a simple python script with
py_binary(
name = "test",
srcs = ["test.py"],
data = ["bpy.so"],
python_version = 'PY3',
)
As seen, I'm hoping to be able to import bpy
, a library I built according to https://wiki.blender.org/wiki/Building_Blender/Linux/Ubuntu.
I was able to locate it after bazel build
, but its name is no longer bpy.so
, but bpy__py_binary_resource_test__h6PPJs.so
. So now when I tried to import it, I get
ImportError: dynamic module does not define init function (initbpy__py_binary_resource_test__h6PPJs)
My Questions
(1) Is data = ["bpy.so"]
the correct way to make sure I can import bpy
on a remote machine after blaze build
? I always feel weird to use the keyword data
for a lib...
(2) If this is the correct way, how do I import it after the build, since the filename has changed and the init
function inside will no longer be reachable (as told by the error message).
For future readers, I was able to solve this problem by not bazel build
'ing it into a .par
.