Help with tuples please?
Mark Hammond
mhammond at skippinet.com.au
Tue Dec 7 08:09:42 EST 1999
Arinte wrote in message <82ivrl$744$1 at rtpnews.raleigh.ibm.com>...
> char* vstr;
> nobj = PyObject_GetAttrString(tobj,"argname"); <-successful, nobj not
null
> if(!PyArg_ParseTuple(nobj, "s", &vstr)){ <-here is where it fails
> appcallback()->messageBox("not again");
> }
As you saw from the code, PyArg_ParseTuple requires a tuple. If it almost
certain that nobj is not a tuple, but a string. [Just saw the .py code
below - _definately_ a string :-)
You probably want:
nobj = PyObject_GetAttrString(tobj,"argname"); <-successful, nobj not null
if(!PyString_Check(nobj)) {
appcallback()->messageBox("not a string");
getout!
}
vstr = PyString_AsString(nobj);
Mark.
More information about the Python-list
mailing list