We have Python 3.6 installed in our z/OS 2.2 and it works fine in interactive mode.
However when I tried to write my own application and embed Python there I ran into problem with call to Py_Initialize().
It receives control and then terminates abnormally with Fatal Error apparently while reading file …lib/python3.6/encodings/init.py
I also receive a message that looks like complete garbage, but when I redirected it to a file and tagged it as ASCII i was able to seen this:
File “/usr/lpp/python36/lib/python3.6/encodings/init.py”, line 1
… several ines of the same garbage…
SyntaxError: invalid syntax
initstdio: failed to import module encodings.utf_8
Fatal Python error: Py_Initialize: can’t initialize sys standard streams
Environment variable _BPXK_AUTOCVT set to ON;
The env variable PYTHON_HOME is set correctly, so my C program can see Python DLLs. and all I do in my main() is a call to Py_Initialize ();
It seems to me the Py_Initialize () is reading this file using incorrect encoding.
What am I doing wrong?
Here is my small repro of the problem:
int main (int argc, char* argv)
int i, j, done = 0; /* variables I will need later */
The compile command:
c++ -c -W"c,lp64,FLOAT(HEX)" -W"c,DFP,TUNE(7),ARCH(7)" -+ -W"c,LANG(EXTENDED),XPLINK(STOREARGS),XPLINK(BACKCHAIN)" -W"c,FEDBG(-qxflag=EnableDeclToTypeLinkagePropagation)" -W c,expo,ros -2 -W c,NOANS,gonumber -I/usr/lpp/python36/include/python3.6m -I/usr/lpp/python36/lib/python3.6/site-packages/numpy/core/include -o ptst.o ptst.c
c++ -Wl,lp64 -o ptst.out ptst.o /usr/lpp/python36/lib/libpython3.6m.x -lm -lc