How to convert a C string (char array) into a Python string when there are non-ASCII characters in the string?

后端 未结 3 1249
星月不相逢
星月不相逢 2020-12-19 06:06

I have embedded a Python interpreter in a C program. Suppose the C program reads some bytes from a file into a char array and learns (somehow) that the bytes represent text

3条回答
  •  梦毁少年i
    2020-12-19 06:34

    Try calling PyErr_Print() in the "if (!py_string)" clause. Perhaps the python exception will give you some more information.

提交回复
热议问题