joaoventura / pybridge

Reuse Python code in native Android applications
215 stars 56 forks source link

Python 2.7 implementation #4

Closed darnmason closed 4 years ago

darnmason commented 7 years ago

Hey, any chance you could whip up an example using Python 2.7?

I tried just changing the Android.mk file to point to CrystaX's 2.7 sources, however I get errors in the pybridge.c file when executing ndk-build

jni/pybridge.c:39:15: error: variable 'AndroidlogModule' has initializer but incomplete type static struct PyModuleDef AndroidlogModule = { ^ I'd love to use an existing Python library in a new Android app which is why I'm looking into this, but the library is written in Python 2.7 which I have no experience with so this is all new to me! I've appreciated your blog posts and this project for showing me that it's possible so thanks so far.

joaoventura commented 7 years ago

This version of PyBridge is only for Python 3, as there are some differences from 2.7 to Python 3 regarding the C API.. However, you can check my blog here where I have done something previously for Python 2 and try to adapt it to what I've done here with PyBridge: http://joaoventura.net/blog/2014/python-android-2/

frmdstryr commented 7 years ago

I added 2.7 support in the fork here: https://github.com/frmdstryr/pybridge Could possibly submit a PR, just unsure of how is best to include each.

joaoventura commented 7 years ago

As I don't want to have to maintain the 2.7 fork in the future, I think your fork could have more exposure for those who need it if I reopen the issue here, and I can also add a link to your fork in the readme file.. Do you plan to keep maintaining your 2.7 fork?

joaoventura commented 4 years ago

Python 2.7 is no longer being supported, closing this issue.