Help with tuples please?

Arinte shouldbe at message.com
Tue Dec 7 07:56:34 EST 1999


This is the third time I have posted this, but since I have gotten no
replies I assume my other stuff wasn't clear enuff or there is a problem
with python on my machine.  I am in the process of moving to a win98 machine
for testing instead of NT.  Anywho, I have narrowed my problem down a bit.
Here is were my PyArg_ParseTuple is failing...

in python's source getargs.c

 if (!PyTuple_Check(args))

  PyErr_SetString(PyExc_SystemError,
      "new style getargs format but argument is not a tuple");

I don't understand why that is happening?  Is there another way to get the
value from a PyObject

This is my c++ code...

  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");
  }

tobj is an object of the type below from an array (list) that I pass from
python to c++.

class PossArg:
 argname=""
 argvalue=0
 def __init__(self,argname, argvalue):
  self.argname = argname
  self.argvalue = argvalue

 def getValue(self):
  return self.argvalue
 def getName(self):
  return self.argname

 def setValue(self, value):
  self.argvalue = value






More information about the Python-list mailing list