Short post, since it's late.
Python on the PlayBook. What will be BBX-Python, some day...
So I wrote an app. First time using the Tablet OS Native SDK so lots of learning curve to climb with Momentics (the IDE) and some of its warts. Generally it was way better than I'd expected actually, and the warts are the sort of thing you work around then gradually forget they're even there.
The app for now pretty much consists of the following code:
fprintf(stderr, "py_initialize\n"); Py_VerboseFlag = 1; Py_Initialize(); // ... other stuff in a loop waiting for the end of the world Py_Finalize();
There's a bit more to it than that, but nothing that's relevant to the Python aspect. I did have to set up an environment variable to point to the library, so there's an "LD_PRELOAD=/usr/lib/libpython3.2m.so.1.0" somewhere, too.
The beautiful thing is that it just worked. Here's the output, courtesy of the one debug line above and the output triggered by the verbose flag:
py_initialize # installing zipimport hook import zipimport # builtin # installed zipimport hook import encodings # directory /usr/lib/python3.2/encodings import encodings # precompiled from /usr/lib/python3.2/encodings/__init__.pyc import codecs # precompiled from /usr/lib/python3.2/codecs.pyc import _codecs # builtin ... import bisect # precompiled from /usr/lib/python3.2/bisect.pyc dlopen("/usr/lib/python3.2/lib-dynload/_bisect.so", 2); import _bisect # dynamically loaded from /usr/lib/python3.2/lib-dynload/_bisect.so dlopen("/usr/lib/python3.2/lib-dynload/_heapq.so", 2); import _heapq # dynamically loaded from /usr/lib/python3.2/lib-dynload/_heapq.so import weakref # precompiled from /usr/lib/python3.2/weakref.pyc import reprlib # precompiled from /usr/lib/python3.2/reprlib.pyc import _thread # builtin import _locale # builtin import encodings.ascii # precompiled from /usr/lib/python3.2/encodings/ascii.pyc
Next step will be to tell it to execute a script with PyEval_EvalCode() or something like that.
Join me on #bbx-python on freenode.net if you're interested in following this, or add a comment to this post. I'll also be tweeting a bit as @peter9477. Thanks!
As of June 2012, we've renamed this the BlackBerry-Py Project. You can follow news about it at @BBPyProject and the web site has moved too.