Travis
Travis

Reputation: 1143

Python C-API PyUnicode_FromString

I'm working with the Python C API, and while I've googled and found somewhat cryptic answers (that don't solve my problem), I can't seem to get past this error.

When compiling my program with gcc -shared [...] 'pkg-config --cflags --libs python3' -fPIC [...] (And, yes, the pkg-config line is in backticks), but it produces this error message:

‘PyUnicodeUCS2_FromString((const char *)"[...]")’ is not a function

The line of offending code is simple: PyObject *value = PyUnicode_FromString("foo") which is practically taken from the Python3 documentation. The contents of the example compile fine and run in the Python interpreter without incident with the exact same command line arguments to gcc.

Any help is greatly appreciated! Thanks!

Upvotes: 1

Views: 4365

Answers (1)

Zompa
Zompa

Reputation: 468

When embedding Python within an development environment (LabVIEW) I have encountered this. I was unable to find the PyUnicode_FromString function, from the Python documentation example, but I was able to use PyUnicodeUCS2_FromString, in the same way successfully.

Upvotes: 1

Related Questions