[BRLTTY] Fwd: Orca crash with grade 2 and latest versions of brltty and liblouis
Mario Lang
mlang at delysid.org
Fri Jul 3 04:08:13 EDT 2009
Samuel Thibault <samuel.thibault at ens-lyon.org> 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/key at db.debian.org
: :' : | 1024D/7FC1A0854909BCCDBE6C102DDFFC022A6B113E44
`. `'
`- <URL:http://delysid.org/> <URL:http://www.staff.tugraz.at/mlang/>
More information about the BRLTTY
mailing list