stefan_ml at behnel.de
Wed Mar 17 07:46:20 CET 2010
moerchendiser2k3, 16.03.2010 19:25:
> Hi, currently I am not at home, I will post some stuff when I am back.
> Just the note: I throw an exception with the C API.
> Looks like that
> PyObject *result = PyObject_Call(my_isntance, "", NULL);
> PyErr_Print(); //when this happens, the traceback is correct with
> information about the file/line
> PyErr_SetString(PyExc_TypeError, "Wrong type, ....");
> PyErr_Print(); //missing information of the file/line.
> Well, I expect, that there are no information about the line/file, so
> I know something is missing, but what is missing?
Two solutions here:
1) put the line number information into the message string when you raise
2) use Cython instead of plain C, as Cython will automatically generate
readable stack traces for you, also for non-Python functions.
More information about the Python-list