mahboubi added the comment: 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() ---------- status: pending -> open Added file: http://bugs.python.org/file46841/write_to_xml1.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30195> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com