Samuel Thibault <[email protected]> writes: > Willie Walker, le Thu 02 Jul 2009 15:29:45 -0400, a écrit : >> BrlAPI provides a brlapi_setExceptionHandler method, but I'm not sure >> how to get to it from Python. Can you BrlTTY folks offer some guidance? > > We haven't implemented anything for this yet. The issue is being able > to call python code from the C code, I don't know how this is allowed to > be done.
The following article is probably pretty helpful: http://www.codeproject.com/KB/cpp/embedpython_1.aspx #include <Python.h> int main(int argc, char *argv[]) { PyObject *pName, *pModule, *pDict, *pFunc, *pValue; if (argc < 3) { printf("Usage: %s python_source function_name\n", argv[0]); return 1; } Py_Initialize(); pName = PyString_FromString(argv[1]); pModule = PyImport_Import(pName); pDict = PyModule_GetDict(pModule); pFunc = PyDict_GetItemString(pDict, argv[2]); if (PyCallable_Check(pFunc)) { PyObject_CallObject(pFunc, NULL); } else { PyErr_Print(); } /* Clean up */ Py_DECREF(pModule); Py_DECREF(pName); Py_Finalize(); return 0; } -- CYa, ⡍⠁⠗⠊⠕ | Debian Developer <URL:http://debian.org/> .''`. | Get my public key via finger mlang/[email protected] : :' : | 1024D/7FC1A0854909BCCDBE6C102DDFFC022A6B113E44 `. `' `- <URL:http://delysid.org/> <URL:http://www.staff.tugraz.at/mlang/> _______________________________________________ This message was sent via the BRLTTY mailing list. To post a message, send an e-mail to: [email protected] For general information, go to: http://mielke.cc/mailman/listinfo/brltty
