How can I get a PyObject reference to an object already created?
Yuriy Gorvitovskiy
yuriy at centricsoftware.com
Thu Mar 16 22:21:41 EST 2000
You can try this function:
PyObject* PyRun_String (char *str, int start, PyObject *globals,
PyObject *locals)
But I can't find the description of it in documentation.
I'm doing this way:
m_PyPublishModule = PyImport_ImportModule("CustomScript");
PyObject* pPyNewObject = PyObject_CallMethod(m_PyPublishModule,
"CreateCustomClassFunction","");
if (!pPyNewObject)
{
PyErr_Print();
}
else
{
// Do Your Work
....
}
Py_XDECREF(pPyNewObject);
Py_XDECREF(m_PyPublishModule);
[YG]
drugar at my-deja.com wrote in message <8arruu$dpm$1 at nnrp1.deja.com>...
>In particular this is Win32 project that embeds the python
>interpretor. Can I get a PyObject reference to an object that is
>created by a script?
>For example:
>
>PyRun_SimpleString("import CustomScript\n");
>PyRun_SimpleString("t=CustomClass()\n");
>
>Is there anyway to get a reference to t? or any other object that is
>created by importing CustomScript? Assuming I know it's "name".
>
>Thanks
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
More information about the Python-list
mailing list