C
Chun-Chieh Huang
Dear all,
I carefully lookup PyObject_Print in the API manual, but I can't find
the resolution. And the problem is described below:
I embed python into C++ code as follows:
// First register function objects
pModule = PyImport_ImportModule("merge");
pDict = PyModule_GetDict(pModule);
pFunc = PyObject_GetAttrString(pModule, "TopoCreator");
PyObject *theArg = PyString_FromString("FOSS");
theTopoDesigner = PyObject_CallFunctionObjArgs(pFunc, theArg);
addPiconet_Topo = PyObject_GetAttrString(theTopoDesigner,"addPiconet");
// Create
PyObject *tmpList = PyList_New(maxNumber);
// setting values of tmpList
PyObject_Print(tmpList, stdout, 0);
pValue = PyObject_CallFunctionObjArgs(addPiconet_Topo, tmpList);
The problem is that if I comment out the line "PyObject_Print," I'll
get an error message:
"TypeError: addPiconet() takes exactly 2 arguments (3 given)"
But if I add back the PyObject_Print line, it works as
expected. However, I don't need PyObject_Print when the system is
finished; I use it for debugging purpose. The "addPiconet" method
takes a list as an argument, which is declared as:
def addPiconet(self, aList):
Blah blah blah
I really don't know how to solve it. How can I make it work without
PyObject_Print? Any suggestion? Thanks in advance.
Albert
--
Chun-Chieh Huang, aka Albert E-mail: jjhuang AT cm.nctu.edu.tw
¶À«T³Ç
Department of Computer Science
National Tsing Hua University MIME/ASCII/PDF/PostScript are welcome!
HsinChu, Taiwan NO MS WORD DOC FILE, PLEASE!
I carefully lookup PyObject_Print in the API manual, but I can't find
the resolution. And the problem is described below:
I embed python into C++ code as follows:
// First register function objects
pModule = PyImport_ImportModule("merge");
pDict = PyModule_GetDict(pModule);
pFunc = PyObject_GetAttrString(pModule, "TopoCreator");
PyObject *theArg = PyString_FromString("FOSS");
theTopoDesigner = PyObject_CallFunctionObjArgs(pFunc, theArg);
addPiconet_Topo = PyObject_GetAttrString(theTopoDesigner,"addPiconet");
// Create
PyObject *tmpList = PyList_New(maxNumber);
// setting values of tmpList
PyObject_Print(tmpList, stdout, 0);
pValue = PyObject_CallFunctionObjArgs(addPiconet_Topo, tmpList);
The problem is that if I comment out the line "PyObject_Print," I'll
get an error message:
"TypeError: addPiconet() takes exactly 2 arguments (3 given)"
But if I add back the PyObject_Print line, it works as
expected. However, I don't need PyObject_Print when the system is
finished; I use it for debugging purpose. The "addPiconet" method
takes a list as an argument, which is declared as:
def addPiconet(self, aList):
Blah blah blah
I really don't know how to solve it. How can I make it work without
PyObject_Print? Any suggestion? Thanks in advance.
Albert
--
Chun-Chieh Huang, aka Albert E-mail: jjhuang AT cm.nctu.edu.tw
¶À«T³Ç
Department of Computer Science
National Tsing Hua University MIME/ASCII/PDF/PostScript are welcome!
HsinChu, Taiwan NO MS WORD DOC FILE, PLEASE!