[C++-sig] Type Exception of type Argument Error

Brian Hall bhall at gamers-fix.com
Sun Jul 11 06:26:33 CEST 2004

Hello all,


I'm getting really close on my defining derived C++ types in python and
having them instantiated and executed from C++, but I've run into a snag.


I have the following module defined:




      // Expose the State class to Python

      class_<cState>("State", init<float, std::string>())

            .add_property("value", &cState::Value, &cState::SetValue)

            .add_property("initial_value", &cState::InitialValue,



      // Expose a base class new scripted actions should derive from

      class_<cPythonScriptedAction>("PythonScriptedAction", init<cState&>())

            .def("state", &cScriptedAction::State,



      // Expose a base class new scripted transitions should derive from

init<cState&, cState&>())

            .def("source", &cPythonScriptedTransition::Source,

            .def("target", &cPythonScriptedTransition::Target,




The State(), Source(), and Target() methods of the Actions and Transitions
all return a reference to an internally held cState class.

However if I try to call the execute method on the following Action python


from GI_AISDK import *


class TestAction(PythonScriptedAction):


      def __init__(self):



      def execute(self):



I get a Type Exception with the annotation Argument Error.  I'm not entirely
sure what could be going on here.  I also tried the
reference_existing_object but to no avail.  If I simply pass in that method,
it executes fine.  In fact I can do whatever I want except call that state()


Any ideas?




Brian Hall

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040710/e32f87c3/attachment.htm>

More information about the Cplusplus-sig mailing list