On Aug 23, 1:17 pm, TheShadow <[EMAIL PROTECTED]> wrote: > On Aug 23, 11:57 am, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > > > TheShadow wrote: > > > When extending python in c/c++ after you register a module is there a > > > way in c/c++ to check if they were correctly registered? > > > > Cause I'm having the problem where when I execute the the python > > > script it finds the module but none of the functions. > > > Are you calling Py_InitModule(...) in your initmodule function? If so, > > Py_InitModule(...) returns a reference to the module object. You can use > > this object to double check that your function names exist in the > > modules dictionary. Most likely, there is an error in your code. If you > > post it, it would be easier to tell what the problem is. > > > -Farshid > > Alright that was a dead end. Here is the source code. > > bool CPythonModule::Register() > { > bool bReturn = false; > unsigned int uiSize = static_cast<unsigned > int>(m_LPyMethodDefs.size()); > if (m_LPyMethodDefs.size() > 0) > { > m_pEmbMethods = new PyMethodDef[m_LPyMethodDefs.size()+1]; > unsigned int uiCounter = 0; > > IterQPyMethodDefs iterMethods = m_LPyMethodDefs.begin(); > > while (m_LPyMethodDefs.end() != iterMethods) > { > m_pEmbMethods[uiCounter].ml_name = > m_LPyMethodDefs.front().sName.c_str(); > m_pEmbMethods[uiCounter].ml_meth = > m_LPyMethodDefs.front().pFunction; > m_pEmbMethods[uiCounter].ml_flags = > m_LPyMethodDefs.front().iFlags; > m_pEmbMethods[uiCounter].ml_doc = > m_LPyMethodDefs.front().sDoc.c_str(); > > ++uiCounter; > ++iterMethods; > } > > PyMethodDef PyMethodNullDef = {NULL, NULL, 0, NULL}; > > m_pEmbMethods[uiSize] = PyMethodNullDef; > > Py_InitModule(m_sModuleName.c_str(),m_pEmbMethods); > > //PythonInterfaceInst->RegisterModule(this); > > m_pInitFunc(); > > bReturn = true; > } > return bReturn; > > }
Forget I said anything I found my bug... I was using m_LPyMethodDefs instead of my iterator... hurray for writing code at 12am :P -- http://mail.python.org/mailman/listinfo/python-list