pass bool values to the Python function in embedded python 3.0

BigHand heweiwei at gmail.com
Sat Mar 7 05:20:04 EST 2009


On Mar 7, 5:38 pm, BigHand <hewei... at gmail.com> wrote:
> Guys, How do I transfer the parameters ?
> in python code:
> traceback.format_exception(exc_type, exc_val, exc_tb, 2, True)
>
> in C++ code:
> obFunc_format_exception = PyObject_GetAttrString(modTB,
> "format_exception");
> tbArgs = Py_BuildValue("OOOii", exc_type, exc_value, exc_tb, 2, 1);
> tbResultList = PyObject_CallObject(obFunc_format_exception , tbArgs);
>
> how do I pass True to the Python function in the C++ code?
build the python object
tbArgs  = Py_BuildValue("OOOOO", exc_type, exc_value, exc_tb, Py_None,
Py_True);
tbResultList = PyObject_CallObject(obFunc_format_exception , tbArgs);
but I can't get the format_exception called successfully.
could anyone help me ?



More information about the Python-list mailing list