This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aimad
Recipients aimad, benjamin.peterson, ezio.melotti, lemburg, serhiy.storchaka, vstinner
Date 2017-04-29.14:16:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1493475366.41.0.0930760044083.issue30195@psf.upfronthosting.co.za>
In-reply-to
Content
I have just tried to do this task using xml.etree.ElementTree and still have the same problem.
In the file 'write_to_xml1.py' I'm trying to develop some function that creates an xml file and then add data containing non ascii characters.The python program works perfectly, but when I tried to call  these functions from C, the program crashes.Note that this problem dosn't happen when adding ascii characters only.Here is the C program :

void create_report()
{
	PyObject *pName, *pModule, *pDict, *pFunc, *pValue, *pArgs;

    // Initialize the Python Interpreter
    Py_Initialize();

    // Build the name object
    pName = PyString_FromString("write_to_xml1");
    // Load the module object
    pModule = PyImport_Import(pName);

    // pDict is a borrowed reference 
    pDict = PyModule_GetDict(pModule);

    // pFunc is also a borrowed reference 
    pFunc = PyDict_GetItemString(pDict,"create_report");

	if (PyCallable_Check(pFunc)) 
    {
		PyObject_CallObject(pFunc,NULL);	
    } else 
    {
        PyErr_Print();
    }

}
void modif_report()
{
	PyObject *pName, *pModule, *pDict, *pFunc, *pValue, *pArgs;

    // Initialize the Python Interpreter
    Py_Initialize();

    // Build the name object
    pName = PyString_FromString("write_to_xml1");
    // Load the module object
    pModule = PyImport_Import(pName);
    // pDict is a borrowed reference 
    pDict = PyModule_GetDict(pModule);
    // pFunc is also a borrowed reference 
    pFunc = PyDict_GetItemString(pDict,"traite");
	if (PyCallable_Check(pFunc)) 
    {
		PyObject_CallObject(pFunc,NULL);	
    } else 
    {
        PyErr_Print();
    }

}

int main(int argc, char *argv[])
{
	create_report();
	modif_report();
        return(0);
}      // end main()
History
Date User Action Args
2017-04-29 14:16:06aimadsetrecipients: + aimad, lemburg, vstinner, benjamin.peterson, ezio.melotti, serhiy.storchaka
2017-04-29 14:16:06aimadsetmessageid: <1493475366.41.0.0930760044083.issue30195@psf.upfronthosting.co.za>
2017-04-29 14:16:06aimadlinkissue30195 messages
2017-04-29 14:16:06aimadcreate