Thank you very much for your help Martin, now I got it.
Cheers,
RC
On 9 abr, 00:05, "Martin v. Löwis" wrote:
> > The issue is that all PyUnicode* functions are returning PyObjects.
> > PyString_AsString return value was char*. Is there any real equivalent
> > of this function?
>
> Ah, right. Py
> The issue is that all PyUnicode* functions are returning PyObjects.
> PyString_AsString return value was char*. Is there any real equivalent
> of this function?
Ah, right. PyString_AsUTF8String returns a bytes object, to which you
need to apply PyBytes_AsString to. At the end, you need to decref
Sorry but it did not help... I tried this:
PyObject* key = PyList_GetItem(moduleKeys,idx);
char* theKeyName = PyUnicode_AsUTF8String( key );
And this, just in case:
PyObject* key = PyList_GetItem(moduleKeys,idx);
char* theKeyName = PyUnicode_AsUTF8String( PyObject
> PyObject* key = PyList_GetItem(moduleKeys,idx);
> PyObject* module = PyDict_GetItem( interp->modules, key );
> char* theKeyName =
> PySys_WriteStdout("Module '%s'\n", theKeyName);
> }
> I was not able to obtain theKeyName, knowing that the "key" PyObject
> is