Closed kabukky closed 5 years ago
Here's the workaround I'm using now:
In PyBridge.java:
public static JSONObject call(JSONObject payload) {
try {
String[] abis = Build.SUPPORTED_ABIS;
payload.put("architecture", abis[0]);
String result = call(payload.toString());
return new JSONObject(result);
} catch (JSONException e) {
e.printStackTrace();
return null;
}
}
In boostrap.py:
import os
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/libs/' + args['architecture'])
Then I put the .so files in the corresponding assets/python/libs/<arch>
folders.
That works fine. Is there a better way?
I have the same problem. How did you solve it?
@ZhangKuixun see my workaround above.
You should put
import os
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/libs/' + args['architecture'])
at the top of the python function you are calling since that is where you will have access to args['architecture']
.
Failure, there are still the same mistakes @kabukky
@ZhangKuixun this issue is about including .so
files for ALL architectures. However, I've commented in your issue about the missing _ctypes.so
, which is is separate issue.
File "/data/user/0/com.jventura.pyapp/assets/python/stdlib.zip/platform.py", line 115, in
File "/data/user/0/com.jventura.pyapp/assets/python/stdlib.zip/subprocess.py", line 438, in ImportError: No module named 'select'
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/libs/arm64-v8a')
in bootstrap.py
there are still the same mistakes @kabukky
_ctypes.so has been solved, I annotate # import ctypes
.
this is my demo, https://github.com/ZhangKuixun/pybridge Can you take a look at it for me? @kabukky
@ZhangKuixun, please don't open issues begging for user support like you have been doing..
Hi, is there a way to include the
$(CRYSTAX_PATH)/sources/python/3.5/libs/$(TARGET_ARCH_ABI)/modules/select.so
file for all architectures?I know I can copy the
select.so
to theassets/python
folder - that works. But that will only include it for one architecture.I tried it like this, in the
Android.mk
, but the python interpreter can't find it:Error: