exec a string in an embedded environment
Tommy Ryding
Tommy.Ryding at gmail.com
Tue Jan 17 04:29:46 EST 2006
No it didn't help me :(
the foo_ptr that is returned from PyRun_String is not a callable
object. Therefor I can't call it from PyObject_Call.
I would like to do the exact same procedure as I do when the code is
located in a module (file).
pModule = PyImport_Import(pName);
Py_DECREF(pName);
if (pModule != NULL) {
pFunc = PyObject_GetAttrString(pModule, inArg->funcName);
/* pFunc is a new reference */
if (pFunc && PyCallable_Check(pFunc)) {
It must be possible to import a module written inside a string with a
similar approach. The ultimate solution would be to change the
PyImport_Import() call to something that creates an object from a
string
Now some of you think why not have the code inside a file. We need to
create encrypted script files, thats why.
I hope someone can help me //Tommy
More information about the Python-list
mailing list