Absolultely confused...

Thomas Heller theller at python.net
Thu Oct 6 10:26:14 EDT 2005


Jeremy Moles <jeremy at emperorlinux.com> writes:

> So, here is my relevant code:
>
> 	PyArg_ParseTuple(args, "O!", &PyType_vector3d, &arg1)
>
> And here ismy error message:
>
> 	argument 1 must be pylf.core.vector3d, not pylf.core.vector3d
>
> I know PyType_vector3d "works" (as I can use them in the interpreter all
> day long), and I know I'm passing a pylf.core.vector3d (well, apparently
> not...)
>
> I've spent hours and hours on this and I'm finally just giving up and
> asking. I've tried everything to get my program to verify that arg1 is
> really a PyType_vector3d, but to no avail.
>
> If I take out the "!" in the format string and just use "O", I can at
> least get past PyArg_ParseTuple. Then I try something like...
>
> 	PyObject_TypeCheck(arg1, &PyType_vector3d)
>
> Which also fails, but I know for a fact that arg1's PyObject_Repr is
> what it should be. (pylf.core.vector3d)
>
> I guess my question is: what in the world could be causing this to fail?
> It seems like I'm just not able to use ParseType or BuildValue to create
> objects of my own type.
>
> I know I haven't provided a lot of information, but does anyone have any
> ideas or where I should start looking?

Can it be that you have TWO instances of the pylf.core.vector3d object?
Debugging should reveal it...

Thomas



More information about the Python-list mailing list